Using the Clipboard

This is a very basic sample app to assist a thread in the newsgroup. Basically it shows a couple of approaches to working with the Clipboard, both using SDF v1.3.

The first is the TextBoxEx class onto which I’ve added a ContextMenu with edit commands. The second is a plain TextBox and I’ve added buttons to call methods on the OpenNETCF.Windows.Forms.Clipboard class.

In .NETCF v2.0 there will be basic functionality on the Clipboard class but it wont have the GetText and SetText shortcut methods. The OpenNETCF.Windows.Forms.Clipboard class follows the desktop v2.0 equivalent so should be fairly intuitive to use.

The sample project was written and tested with a Pocket PC 2003. On brief testing with the 2002 emulator the context menu causes problems due to the way a tap and hold is handled and the control loses focus, thus the selection is removed, therefore no text is cut to the clipboard. I have yet to try on Pocket PC 2000/2002 device so I’d be interested in hearing if there are any problems encountered. It requires SDF v1.3 and I also recommend you are running the latest .NET Service Pack (SP3). (9.32 KB)

By Peter Foot

Microsoft Windows Development MVP