Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi All

 

I keep getting the Requested Clipboard Operation did not succeed error when trying to clear the clipboard. I found it to be related to a textbox that has the multiline set to true.

 

Example :

 

I created a new form entered 2 textboxes . The first multiline = false and the second multiline = true. I also create a module. In the module I created the following methods.

Public Function fnVerifyFile() As Boolean 
       fnClearClipBoard()
End Function

   Public Function fnClearClipBoard() As Boolean 

       Try

           Clipboard.Clear()

       Catch ex As Exception

           MessageBox.Show(ex.Message)

       End Try

In the textboxes_TextChanged I put

 Try
           fnVerifyFile()
 Catch ex As Exception
           MessageBox.Show(ex.Message)
 End Try

My main program has other code that's not relevant here but its purpose was to check data being pasted into the program through the clipboard and it is checking for certain characters that are not valid. If any bad data found then clear the clipboard.

 

So I then open up Notepad, keyed in some text , copied it and pasted into the first text and no error. I then pasted the same text into the second textbox and the error accurs.

 

Anybody know of why this might be?

 

I'm using XP Pro sp2, VS 2005 .NET 2.0

 

Regards

-Paul

Edited by PlausiblyDamp
  • Administrators
Posted
Not sure why the problem you are encountering is occurring, however it might be easier and more standard to just ignore the attempt to paste invalid data into your application - after all it may be perfectly valid data for another application I also intend to paste into; in your scenario it would clear the contents if I tried your app first and the other app second but would seem to work if I attempted it in a different order.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...