I was developing a TCP/IP based Chat Application.
When i was sending the data from the server to the client using send method of Socket Class Object and on the client side i was receiving the data using the BeginReceive andEndReceive method of socket class.
Till here it's functioning properly but when i assigned the content sent by the server to the textbox .NET throws an exception
*Cross Threaded call are not allowed. ThisText box is defined in some other thread.*
I searched a lot on this to find the solution.
Finally I got the solution.
The solution is :-
The solution is to write
Control.CheckForIllegalCrossThreadCalls =false;
in Page Load
CheckForIllegalCrossThreadCalls is a static propertyin the load event handler of the main form.
(Don't worry if this property doesn't appear in the intellisense menu )
This problem happens because a thread other than the one who created a control is attempting to modify its properties.
Enjoy...
No comments:
Post a Comment