Requested Clipboard Operation Error

Data Danger

Freshman
Joined
Mar 25, 2004
Messages
29
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.
Visual Basic:
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
Visual Basic:
  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
 
Last edited by a moderator:
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.
 
Back
Top