lothos12345 Posted April 5, 2006 Posted April 5, 2006 i am using the clipboard to copy and paste text on the textcontrol. Which seems to work fine on some computers well as others it throws me the following error. Cannot read from or write to the clipboard (01-1603) throwkernelerror One thought I had was after each paste of the text or before I set the dataobject in the clipboard, i call the garbage collector. My thought is that something the computer is doing is locking the clipboard and calling the garbage collection will free the clipboard up. Quote
Leaders snarfblam Posted April 5, 2006 Leaders Posted April 5, 2006 This begs the question: why are you calling the garbage collector. As long as you know that this is supposed to be automated and understand the implications of explicitly invoking a garbage collection (under most circumstances it will actually cause the garbage collector to perform less efficiently), or in other words, if you really know what you are doing, then do what you will, but I'd recommend you avoid calling the garbage collector explicitly. If you must call the garbage collector, I don't know the finer details but it could be that something relating to the ClipBoard class is pinned or being moved or something. I don't know if code is allowed to be executed during a collection. If that is the case, you might want to try to do an Application.DoEvents after the call to GC.Collect to allow the GC thread to finish up. Otherwise, I don't know what to tell you. Quote [sIGPIC]e[/sIGPIC]
lothos12345 Posted April 7, 2006 Author Posted April 7, 2006 I am not calling the garbage collector as of yet, it was just an ideal I had, I thought that something was still using the clipboard and the program was not giving the clipboard enough time to do what it needed to do. Garbage collection i would force it to clean itself up. Not sure what else to try. Some computers I have no problem to use the clipboard for copying and pasting. While still others I get the error. Any thoughts? Quote
Cags Posted April 7, 2006 Posted April 7, 2006 Are all of the test PC's using the same version of windows, or are the PC's running a certain version of Windows not working correctly? Quote Anybody looking for a graduate programmer (Midlands, England)?
lothos12345 Posted April 7, 2006 Author Posted April 7, 2006 Yes all the systems are running the exact same version of the Windows and the exact same version of the application and all the pc's are the same as far as hardware and brand. Quote
Leaders snarfblam Posted April 7, 2006 Leaders Posted April 7, 2006 My bad. I guess I should pay attention when I read a post. I thought you said that you were forcing garbage collections. But have you tried calling Application.DoEvents to let other threads finish what they are doing before accessing the clipboard? I don't see why it should be necessary, but who knows? Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.