[RESOLVED] Problem with Form Load
Hello.
I have this code:
Code:
Imports System.ComponentModel
Public Class Form1
Dim ErrText As Integer = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeBackgroundWorker()
BackgroundWorker1.RunWorkerAsync()
End Sub
Public Sub InitializeBackgroundWorker()
BackgroundWorker1 = New BackgroundWorker
With BackgroundWorker1
.WorkerReportsProgress = True
.WorkerSupportsCancellation = True
End With
End Sub
'Dim Backgroundworker1 As BackgroundWorker
Public WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
BackgroundProcessWOL()
End Sub
Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
//complete code//
End Sub
Private Sub BackgroundProcessWOL()
//Some work//
End Sub
End Class
It should run when the app is started, but when i load it, it just keeps opening more and more of the same form that it's meant to open ONCE. Any ideas?
Re: Problem with Form Load
Is that all the code you have? I don't see a reason why it keeps opening new instances of the form.
Re: Problem with Form Load
This is the article to read for the use of BackgroundWorkers