cross link two different threads

sumit.sinha

New member
Joined
May 4, 2010
Messages
2
Programming Experience
Beginner
hi guys, this is sumit from Larsen & Toubro Mumbai-India,
I am writing a code for some sort of software in which execution of some code is required as soon as my software receive a barcode from barcode scanner (serial input). Now through datareceived event handler i am able to read the barcode but after that i am not able to send this barcode to any textbox or even i am not able to start any other event like performclick to any button or anything. I am getting an exception as cross linking of threads not possible. please refer to the image and give me the solution asap.
Thanx
Sumit

debug.jpg
 
The term is "Thread Delegation" meaning you have to access/change a control's property through a delegate, which require invoking the object first. Something along these lines:
VB.NET:
If Object.InvokeRequired Then
    DelegateSub(Pass the data along here)
Else
    Object.Property = whatever
End If
 
still not able to do it

hey, thanx for the reply but this code is also not working.
the method which I am invoking by this process is then giving an exception as cross threading not possible.

can u please describe this process better (mayb the whole code) because may be I am not able to code it properly.

lets say textbox1 is the textbox where i have to show the data received from the serial port and the name of the serial port is data.

so please tell the code what i have to write inside the data_datareceived event handler.

regards
Sumit
 
Back
Top