I am trying to add som finishing touches on my program
I would like to add a splash screen that loads my main form
my main form is rather large so I would also like to add a progress bar showing how far along the loading is what I have is
Private Sub Form_Activate()
DoEvents
Load frmOrders
End Sub
How do I attach Progress bar?
Last edited by wallacejww; Feb 16th, 2005 at 12:55 PM.
I don't think that is possible. You can't call the Load function and then find out how far along it is because there is no break in between the code. Once you make the call to Load you cannot stop it or ask for how far along it is, so there is no way to keep a progress bar on it.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
You can however do what i do, in a similiar case. Stick a timer on your form (obviously rename the following code to suit), and copy my splash screen code:
VB Code:
Private Sub tmrProgress_Timer()
'Initialize progress bar
prgMain.Value = prgMain.Value + 1
If prgMain.Value = 25 Then
Load frmMain
ElseIf prgMain.Value = 99 Then
Unload Me
frmMain.Show
End If
End Sub
This wont show the TRUEprogress, but it simulates the loading with a progressbar. Oh and set the Timer Interval to how fast you want the progress, i usually start with 100, then change to suit.
You could do that just strictly for visual effects. But if you are on a faster computer the loading might get done before the timer completes the progress bar. Or the opposite where the timer completes the progress bar but the form is still loading. You are also in your logic slowing down the loading because you don't call to load the form until the progress is up 25%, which it did nothing during the time.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
Ill not go into this too much, dont want to spam this thread do we. Basically you will see and understand the logic around why i dont call frmMain until 25% when my app is complete. Which i will ensure ill let you know when its done. Im looking forward to completing this . If you would like to speak more, just email or make a thread in Chit Chat, we'll talk there.
Anyway, back to this thread..........Imitating the progress isnt all that bad, i use it many of times, for the Visual effect if anything.
You can display a progress bar while loading a form if there is code in the form that is executed while the form is loading. If that's the case just place statements like ProgressBar1.Value = 10, ProgressBar1.Value = 20, ProgressBar1.Value = 27 in various places (and with various values). It will work but it will take some experimentation to make it progress smoothly.
Originally posted by MartinLiss If that's the case just place statements like ProgressBar1.Value = 10, ProgressBar1.Value = 20, ProgressBar1.Value = 27 in various places (and with various values). It will work but it will take some experimentation to make it progress smoothly.
You probably know better than me anyway marty , but anyway. I though you use say ProgressBar1.Value + 10, ProgressBar1.Value + 20 etc, to add 10 in this case to the increment. Though im probably wrong. Besides im still learning how the Progressbar interacts and behaves.