if (InvokeRequired)
{
BeginInvoke(new MethodInvoker(delegate()
{
textBox1.Text = args.Fax.Port.ToString();
textBox2.Text = args.Fax.FaxStatus.ToString();
}));
}
From MSDN
Delegate Sub MyDelegate(myControl As Label, myArg2 As String)
Private Sub Button_Click(sender As Object, e As EventArgs)
Dim myArray(1) As Object
myArray(0) = New Label()
myArray(1) = "Enter a Value"
myTextBox.BeginInvoke(New MyDelegate(AddressOf DelegateMethod), myArray)
End Sub
Public Sub DelegateMethod(myControl As Label, myCaption As String)
myControl.Location = New Point(16, 16)
myControl.Size = New Size(80, 25)
myControl.Text = myCaption
Me.Controls.Add(myControl)
End Sub
So
if (InvokeRequired)
{
BeginInvoke(new MethodInvoker(delegate()
{
textBox1.Text = args.Fax.Port.ToString();
textBox2.Text = args.Fax.FaxStatus.ToString();
}));
}
Delegate Sub MyDelegate(faxPort As String, faxStatus As String)
If InvokeRequired Then
Dim aArray(1) as Object
aArray(0) = args.Fax.Port.ToString()
aArray(1) = args.Fax.FaxStatus.ToString();
BeginInvoke(New MyDelegate(AddressOf MySub), aArray)
End If
Sub MySub( faxPort as String, faxStatus as String)
textBox1.Text = faxPort
textBox2.Text = faxStatus
End Sub
I think
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With