السبت، 18 فبراير 2012

BackgroundWorker

BackgroundWorker Class

Executes an operation on a separate thread.

Sample Code

1.Create event DoWork.

Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
'Sample how to disable button send before send email method after that enabled button.
DisableSendButton()
' to do SendEmail method
EnabledSendButton()

End Sub

2. Show how to invoke method when use BackgroundWorker control.

Private Sub DisableSendButton()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(DisableSendButton))
Else
btnSend.Enabled = False
btnCancelSend.Visible = True
End If
End Sub

Private Sub EnabledSendButton()
If Me.InvokeRequired Then
Me.Invoke(New MethodInvoker(EnabledSendButton))
Else
btnSend.Enabled = True
btnCancelSend.Visible = False
End If
End Sub

3.Start BackgroundWorker

BackgroundWorker1.RunWorkerAsync()

Source: http://vbnetsample.blogspot.com/2008/05/backgroundworker-control.html

how to check email how to find an email address how to make an email address how to make a email address how to email how to send an email how to send email how to send a email email from gmail send an email

ليست هناك تعليقات:

إرسال تعليق