Hello.
I have this code:
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?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




Reply With Quote