Hi,
I have a main form which starts up a thread as well as a 2nd form.
How do I make it so that I can access things such as labels on the 2nd form from the thread that was started on form1?
I have some sample code below...
Any help would be much appreciated.
Thanks,
Wagz
I have a main form which starts up a thread as well as a 2nd form.
How do I make it so that I can access things such as labels on the 2nd form from the thread that was started on form1?
I have some sample code below...
Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Form2.Show() Form2.BringToFront() signal = New Class1 End Sub Private signal As Class1 End Class Public Class Class1 Public Sub New() trd = New Threading.Thread(AddressOf task) trd.IsBackground = True trd.Start() End Sub Private trd As Threading.Thread Private Sub task() For i As Integer = 0 To 5 Threading.Thread.Sleep(5000) Form2.Label1.Text = i.ToString Next End Sub End Class
Thanks,
Wagz
Comment