aaaaaargh...OpenNEtCF clipboard issue

G

Glyn Meek

One line of my code reads:

Dim data as String = OpenNETCF.Windows.Forms.Clipboard.GetClipboardText()

It WAS working in development mode, but since I have been dicking around
trying to get the correct routines moved to the Pocket PC to get it tow ork
when deployed, this line now fails with:

An unhandled exception of type 'OpenNETCF.Win32.WinAPIException' occurred in
OpenNetCF.Windows.Forms.dll

Additional information: Unicode Clipboard format not available Invalid
pointer

I have a Reference to OpenNETCF.Windows.Forms in the project references, and
have included OpenNETCF.Windows.Forms.dll as a 'content' in the project, but
I must have messed something up during my endless screwing around over the
last 6 HOURS trying to get the OpenNETCF stuff deployed as part of our
installation! Ah well time for bed...tomorrow is another day. Here's hoping
someone who is not sleep deprived can tell me what stupid error I am making
here!

Regards Glyn Meek
 
P

Peter Foot [MVP]

If you are using v1.2 then the GetClipboardText method will raise an
exception if there is no text on the clipboard. In the latest source in the
vault this is improved somewhat to simply return a null. So for the current
version you should wrap your code in a try catch e.g.
Dim data As String = ""
Try
data = OpenNETCF.Windows.Forms.Clipboard.GetClipboardText()
Catch
End Try

Peter
 
Top