hi, im writing a program with multiple threads, and in one of the secondary
threads, i need to access the main form...but the code i wrote throws errors
saying i cant do this. is there anyway i can simply change the text on the
main form from another thread?
my code:
Private Sub ListenBegin()
Try
Dim ep As IPEndPoint
HomeIP = Net.Dns.GetHost Entry(Net.Dns.G etHostName).Add ressList(0)
ep = New IPEndPoint(Home IP, PortNumber)
ListenSocket = New Socket(AddressF amily.InterNetw ork,
SocketType.Stre am, ProtocolType.Tc p)
ListenSocket.Bi nd(ep)
ListenSocket.Li sten(1)
ListenSocket.Be ginAccept(Addre ssOf ListenCallBack, Nothing)
Catch ex As Exception
Call WriteErrors(ex. Message, "ListenBegi n")
Finally
SyncLock Me
''error here
Me.Text = HomeIP.ToString
End SyncLock
End Try
End Sub
--
-iwdu15
threads, i need to access the main form...but the code i wrote throws errors
saying i cant do this. is there anyway i can simply change the text on the
main form from another thread?
my code:
Private Sub ListenBegin()
Try
Dim ep As IPEndPoint
HomeIP = Net.Dns.GetHost Entry(Net.Dns.G etHostName).Add ressList(0)
ep = New IPEndPoint(Home IP, PortNumber)
ListenSocket = New Socket(AddressF amily.InterNetw ork,
SocketType.Stre am, ProtocolType.Tc p)
ListenSocket.Bi nd(ep)
ListenSocket.Li sten(1)
ListenSocket.Be ginAccept(Addre ssOf ListenCallBack, Nothing)
Catch ex As Exception
Call WriteErrors(ex. Message, "ListenBegi n")
Finally
SyncLock Me
''error here
Me.Text = HomeIP.ToString
End SyncLock
End Try
End Sub
--
-iwdu15
Comment