Scooter Posted November 18, 2003 Posted November 18, 2003 I have a splash screen that has an exit timer that closes the form after 8 seconds, is there a way to put a progress bar on the splash screen that shows the progress of the exit timer? Quote Whenever, wherever, whatever
Administrators PlausiblyDamp Posted November 18, 2003 Administrators Posted November 18, 2003 Drag the progress bar from the tool box onto the splash screen. Set the timer to fire every second and update the progress bar in the timer event. After the timer event has fired 8 times close the splash screen. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Scooter Posted November 18, 2003 Author Posted November 18, 2003 How would I code this to happen? Every time I tried to make that happen it wouldn't work. (Fairly new at VB.net) Quote Whenever, wherever, whatever
Machaira Posted November 18, 2003 Posted November 18, 2003 Something like: Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Static iIterations As Integer = 0 iIterations += 1 If iIterations = 8 Then Me.Close() End Sub Quote Here's what I'm up to.
Scooter Posted November 18, 2003 Author Posted November 18, 2003 VB: -------------------------------------------------------------------------------- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Static iIterations As Integer = 0 iIterations += 1 If iIterations = 8 Then Me.Close() End Sub How does that tie into the progress bar? Do I have to declare a variable for the progress bar before entering the code above? Also instead of 1 and 8, should it be 1000 and 8000 since the timer uses milliseconds? Quote Whenever, wherever, whatever
*Experts* Volte Posted November 18, 2003 *Experts* Posted November 18, 2003 Set the Max property of your ProgressBar to 8, then set the Value of your ProgressBar to iIterations each time the Timer goes through. However, I really hate programs which unnecessarily prolong splash screens, so I recommend against that very strongly. Quote
Scooter Posted November 18, 2003 Author Posted November 18, 2003 I don't want to sound like a dummy, but how do I set the value of my progressbar to iIterations? Also what are iIterations? (I can change the length of the splash screen, 8 seconds was just for testing purposes, I was thinking along the lines of 4 0r 5 seconds for the splash screen) Quote Whenever, wherever, whatever
*Experts* Volte Posted November 18, 2003 *Experts* Posted November 18, 2003 Value is a property of the progress bar. iIterations is the variable given in Machaira's sample code. Also, I wouldn't even recommend using a splash screen if you don't need them. They are only used to indicate progress when loading a large program. 9 times out of 10, one is not needed. Quote
Machaira Posted November 19, 2003 Posted November 19, 2003 Have to agree with Volte here. The only time I can see using a splash screen with a hard-coded display time would be for shareware apps. When the user registers the app, the splash screen isn't displayed. Quote Here's what I'm up to.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.