I need to start loading my data on the mainform while the splash screen makes the user wait
My question is,
Do I declare thread1 in the splashscreen form or do I declare both threads in the main form load area?
Here is splash screen code..I declared th1 as current thread which i assume is the loading of the splash screen
th2 is a sub in the main form which loads after the splash
Imports System.Threading Public NotInheritable Class SplashScreen1 Public th1 As Thread Public th2 As Thread Private Sub splash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load th1 = Thread.CurrentThread th2 = New Thread(AddressOf frmPortland.DownloadPageOregon) Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If (Me.ProgressBar1.Value < 100) Then Me.ProgressBar1.Value += 1 Else Me.Timer1.Enabled = False Me.Hide() End If If (Me.ProgressBar1.Value = 10) Then Dim frm As New frmPortland th2.Start() End If End Sub End Class
So far I am able to get both started but am getting a cross-threading error when the sub is processing on the main form
Did lots of research on this last night and I now realize that I cant use My Beginning VB.Net books for this
This is an advanced topic and it means alot to me to understand it (at least partially anyway)
Also, I need to know if the doevents() call is needed here and where do i put that?
This post has been edited by Schmit38: 23 January 2008 - 10:46 AM