Hello
I have write a simple code just to test about BeginInvoke and EndInvoke methods but i don't get anything.
The form has 2 buttons and 2 labels .. if you press the button1 label1 gets increase and so on .
here what i have do so far
Public Class Form1
Dim mySimpleClass As New simpleClass
Public Delegate Sub doCounDelegate(ByVal yourLabel As Label)
Dim myDoCount As New doCounDelegate(AddressOf mySimpleClass.doCount)
Dim iasync1 As IAsyncResult
Dim iasync2 As IAsyncResult
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
iasync1 = myDoCount.BeginInvoke(Label1, Nothing, Nothing)
'myDoCount.EndInvoke(iasync1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
iasync2 = myDoCount.BeginInvoke(Label2, Nothing, Nothing)
'myDoCount = EndInvoke(iasync2)
End Sub
End Class
Public Class simpleClass
Public Sub doCount(ByVal yourLabel As Label)
For i = 0 To 50
yourLabel.Text = i
Threading.Thread.Sleep(100)
Console.WriteLine(i)
Form1.Refresh()
Next
End Sub
End Class
If i comment the line yourLabel.Text=i i think it works fine i can see the value on the console
any suggestion ??