I am a new user to VB 2005 Express Beta 2.
I have a form with two objects: a button and a serial port.
When data is received on the serial port, I would like to examine it and if appropriate change the status of the button.
I am able to capture the data received event and examine the data received. However, I am unable to change the button's property from within the data received event of the serial port object. When I attempt to do so, I receive the error message "cross thread operation not valid: control XXX accessed from a thread other than the thread it was created on"
I have tried changing both the button and the Serial Port to "Public" in the Modifiers property.
Any assistance would be appreciated.
Rob

Object Visibility
Michel Jongbloed
I was looking into this error message today using VB 2005 and it appears that it is some additional protection put in "By Design" to protect threads from updating controls in other threads.
This I think appears to be different behaviour from 2003 however from searching around if you look at the Backgroundworker class this may be of help for you application as the serial port is probably running in a separate thread from the UI.
The Microsoft help on the BackgroundWorker class has a form which is running a fibonacci sequence calculation in a separate thread. The calculation thread updates the UI thread progress.
You can set the Properties of controls in other threads using delegates and control.invoke method but it doesn't seem intuitive - although there is an example in the help
http://winfx.msdn.microsoft.com/library/default.asp url=/library/en-us/dv_fxmclictl/html/138f38b6-1099-4fd5-910c-390b41cbad35.asp
Jason Presley