|
-
Nov 24th, 2005, 07:14 AM
#1
Thread Starter
Registered User
timer and auto loading of form problems...please help...
ok, so i have 3 times, to each change the rate that the progressbar progresses...
and at the end, i want it to click on the form to load the rest of the app...
and i get an 'object reference not set to an instance of an object'..
VB Code:
Private Sub frmSplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrLoadDB.Enabled = True
lblLoadingDB.BringToFront()
End Sub
Private Sub tmrLoadDB_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrLoadDB.Elapsed
progBarMain.Value = progBarMain.Value + 1
If progBarMain.Value >= 45 Then
tmrLoadDB.Enabled = False
tmrLoadForms.Enabled = True
End If
End Sub
Private Sub tmrLoadForms_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrLoadForms.Elapsed
lblLoadForms.BringToFront()
progBarMain.Value = progBarMain.Value + 1
If progBarMain.Value >= 150 Then
tmrLoadForms.Enabled = False
tmrSecPol.Enabled = True
End If
End Sub
Private Sub tmrSecPol_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrSecPol.Elapsed
lblLoadSecPol.BringToFront()
progBarMain.Value = progBarMain.Value + 1
If progBarMain.Value = 200 Then
tmrSecPol.Enabled = False
End If
End Sub
Private Sub frmSplash_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
If tmrLoadDB.Enabled = False And tmrLoadForms.Enabled = False And tmrSecPol.Enabled = False Then
Dim loginForm As Sparticus.frmLogin
loginForm.Activate()
End If
End Sub
thanks everyone, Justin
-
Nov 24th, 2005, 07:21 AM
#2
Hyperactive Member
Re: timer and auto loading of form problems...please help...
I guess you need to insert a NEW.
From:
Dim loginForm As Sparticus.frmLogin
To
Dim loginForm As New Sparticus.frmLogin
Live long and prosper (Mr. Spock)
-
Nov 24th, 2005, 07:27 AM
#3
Thread Starter
Registered User
Re: timer and auto loading of form problems...please help...
 Originally Posted by alextyx
I guess you need to insert a NEW.
From:
Dim loginForm As Sparticus.frmLogin
To
Dim loginForm As New Sparticus.frmLogin
Thanks, ill remember that for next time...
i just used a sub main() procedure, and an if me.dialogresult = ok statement...
VB Code:
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Dim splash As New frmSplash
If splash.ShowDialog() = Windows.Forms.DialogResult.OK Then
splash.Dispose()
Application.Run(New frmLogin)
Else
splash.Dispose()
End If
End Sub
Private Sub tmrSecPol_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles tmrSecPol.Elapsed
lblLoadSecPol.BringToFront()
progBarMain.Value = progBarMain.Value + 1
If progBarMain.Value = 200 Then
tmrSecPol.Enabled = False
Me.DialogResult = Windows.Forms.DialogResult.OK
End If
End Sub
that works fine for me...thanks for the reply, Justin
-
Nov 24th, 2005, 07:32 AM
#4
Re: timer and auto loading of form problems...please help...
Argh! I don't like Hungarian notation but I particularly dislike it when it's used in type names. Hungarian notation is for variables, so if you have a form variable it may be appropriate to prefix its name with "frm", but if you derive a class from the Form class it is not appropriate to prefic it with "frm". If were going to use Hungarian notation in that situation then you would use "cls" for Class, but that's just silly. Anyway, enough ranting. Activate is like Focus. You can't focus something that isn't visible. You need to Show the form first. You also need to create it, so do follow alextyx's advice too.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|