|
-
Nov 21st, 2006, 07:37 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2005] Small problem with thread
I've found an open source user control which is effectively a clone (almost) of the VB6 Winsock Control. Yes I know theres many out but this is the only one I can get working - sort of. Find it here:
http://www.codeproject.com/vb/net/winsockdotnet.asp
You remember the VB6 winsock events? Connected, DataArrival etc etc....well this .Net control has those too, and here's the problem:
When I place some simple code within the event such as:
VB Code:
Private Sub Winsock1_Disconnected(ByVal sender As Winsock_Control.Winsock) Handles Winsock1.Disconnected
Label1.Text = "dc"
'when the connection is disconnected, set the text of the label
End Sub
It throws an exception:
Cross-thread operation not valid: Control 'Label1' accessed from a thread other than the thread it was created on.
Surely I should be able to access my controls from the events, otherwise the events here, are pretty much useless??
Thanks, any help is much appreciated as always
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|