-
July 22nd, 2010, 08:59 AM
#1
TcpClient in Managed C++
Hey guys,
When I run this managed code snippet:
listener = gcnew TcpListener(MyIPAddress, ServerPort);
listener->Start();
MyTcpClient^ mclient; //TcpClient public
TcpClient^ aux = listener->AcceptTcpClient();
mclient = static_cast<MyTcpClient^>(aux);
I get the following error:
"System error: cross-thread operation not valid: Control 'listBox1' accessed from a thread other the thread it was created on."
Please, I just can´t understand what´s going on!
-
July 22nd, 2010, 12:58 PM
#2
Re: TcpClient in Managed C++
This really looks interesting, because your code fragment doesn't contain listBox1.
Generally, cross-thread operations on Windows Forms controls are not allowed, they should be serialized using Control.BeginInvoke and Control.Invoke methods.
-
August 12th, 2010, 02:06 AM
#3
Re: TcpClient in Managed C++
hi,
cross-thread operations on Windows Forms controls are not allowed, they should be serialized using Control.BeginInvoke and Control.Invoke methods.
regards,
phe9oxis,
http://www.guidebuddha.com
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
|