STAThread issues and the clipboard
Posted on 2008-10-20
Hi, I have a class which handles communication with the serialport. When it receives data, or timeouts, it processes it, and raises an event. The event is then raised in the main form, where after checking if the event was raised because of a success or a failure (using a flag sent with the event), it calls a function which takes an image with a webcam using the avicap32.dll, by copying the image displayed in the picturebox to the clipboard, which is what causes the error, as I understand threading doesnt like clipboard... (this normally works fine if you assign the function to run on pressing a button).
Anyway, on the main form, ive added a PUBLIC SUB Main() sub which starts the application, and ive added the <STAThread()> attribute to this sub, but it makes no difference. Should this be where the <STAThread()> attribute be put, or am I missing something else?