Hi im devloping a client server program using C#. What it basically does is the Server can connect 3,4 clients and they can send messags. To do this i didnt use threads. My problem is when client send a message to server it is not receved to the server. Then it indicate a error "Cross thread operation not valid." This is the solution i found form this site. --------------------------------------------------------- Private Strt As System.Threading.Thread ; Strt = New System.Threading.Thread(AddressOf MyThread1) Strt.Start(); Sub MyThread1 ' Working code ' Working code ' Working code ' Working code ' Working code ' Working code AccessControl() End Sub Private Sub AccessControl() If Me.InvokeRequired Then Me.Invoke(New MethodInvoker(AddressOf AccessControl)) Else ' Code wasn't working in the threading sub ' Code wasn't working in the threading sub ' Code wasn't working in the threading sub ' Code wasn't working in the threading sub ' Code wasn't working in the threading sub Button2.Visible = True Button3.Visible = True Opacity = 1 ShowInTaskbar = True End If End Sub --------------------------------------------------------- but the problem is hence i do not use threads do i need to create threads to solve this problem? Im developing the program using C#, so do i need to implement it in a same way of this code? Thank you so much.. sweenySL
sweenySL
Posts
-
How to solve"Cross thread operation not valid" error when programming with C#.net -
how to get the address of a threadHi:) Thank you so much for your reply. Hence im not much familier with C# it helped me alot. Once again thank you so much.
-
how to get the address of a threadHi, Thanx alot for your reply. :) sweenySL
-
how to get the address of a threadI'm developing a 'socket programming solution for client server architecture'. There a client connects to a server and send messages. But i got this error,"cross thread operation not valid" and found a solution as follows. It has to pass the thread address but i dont know how to obtain a thread address. Could you please tell me how to obtain a thread address. This is the solution i found. ---------------------------------------- Thread mythread = new Thread(addressOf thread1); mythread.start(); Sub MyThread1 ' Working code ' Working code ' Working code ' Working code ' Working code ' Working code AccessControl(); End Sub -------------------------------- Thank you. sweenySL