Its not quite working the way it is supposed to. This is what I have so far. When the progress bar reaches 100% then the splash screen hides and the other form shows
VB Code:
Private Sub DrawProgress(ByVal Value As Long, ByVal Max As Long)
Its not quite working the way it is supposed to. This is what I have so far. When the progress bar reaches 100% then the splash screen hides and the other form shows
1) What is the problem? Isn't that the way it's supposed to work? When the pb gets to 100% it closes and the form opens?
2) You aren't using a Progress Bar? Look at this example to see what I mean.
It's simple, and uses a loop for movement, but it uses the progress bar control.
1) What is the problem? Isn't that the way it's supposed to work? When the pb gets to 100% it closes and the form opens?
2) You aren't using a Progress Bar? Look at this example to see what I mean.
It's simple, and uses a loop for movement, but it uses the progress bar control.
The progress bar is a picture box to look like a progress bar that has 0% to 100% as the progress bar increases.
When the bar gets to 100%, the splash hides and the main form shows, but when you click off the main form, a few seconds later, the main form comes back and then a domino effect. The only way to completely close down the app is to do alt+ctrl+del
I was thinking about that before I came back and I did something similar which also worked. Nothing has come back on screen after clicking off the main form.
Although, instead of using frmSplash.Hide, you should still unload it, as it will cause errors later if you aren't using it again. Or, if you don't want to do that, use something like this in the "Exit" part of your code:
Although, instead of using frmSplash.Hide, you should still unload it, as it will cause errors later if you aren't using it again. Or, if you don't want to do that, use something like this in the "Exit" part of your code:
VB Code:
Dim j As Form
For Each j In Forms
Unload j
Next
..to unload all the forms.
Phreak
definately a valid point you have there. i didnt think about that. must be the newb coming out in me.
i am going to have to research how to unload the form because i only know how to do it when you click on something.... time to search the braille book on this one haha
found it
VB Code:
unload frmSplash
Last edited by BrailleSchool; May 4th, 2005 at 01:51 AM.
I havn't read all the post and this might have been stated, but you could just as easily just add a loading command (step subroutine) for whatever it is that takes ur form so long to load
For instance, I have variety of apps that build database (or retrieve info rather) upon load so that user interaction during prog is not slowed by streaming feeds, I simply load in at start and load out at close (datagrids filled and things) anyway, point is, i add a "splashscreen" which generally just has a progress bar and the word loading or somthing to that effect.
Then on my main form, whever ever the largest chunck of work is being done on load (ie the For Each in database statements), I add one simple line just before "Next" - stepProBar()
the code for it is simple tho you'll need to delagate it on splash form since it's on seperate thread.
To make this easier, add ur splash screen, add a probar to the splash screen
in splash screen code put :
proBar Code:
Delegate Sub stepBarI(ByVal i As Integer)
Public Sub stepI(ByVal i As Integer)
If Me.ProgressBar1.InvokeRequired = True Then
Dim d As New stepBarI(AddressOf stepI)
Invoke(d, New Object() {i})
Else
Me.ProgressBar1.Value += i
End If
End Sub
Public Sub stepBar()
If Me.Visible = True Then
If Me.ProgressBar1.Value < Me.ProgressBar1.Maximum Then
stepI(1)
Else
stepI(0)
End If
End If
End Sub
then ofcourse on your main form, wherever the main work is going on put "stepBar" for each loading command, example:
mainForm Code:
Public Sub prepDatabase()
For Each item In yourDatabase
ArrayList.Add(item)
stepbar() <---Here it will step 1 interval after every added item
Next
End Sub 'this is a really bad example but u should get the idea
this is not likly the best way, but it's what has worked great for me so far, so i figured i'd add, timers can be messy and seem to cause more overhead, this method is very light on my cpu
enjoy
Last edited by spyk3; Feb 15th, 2010 at 05:51 PM.
Reason: really bad last example! :-P