progress bar
-
Does anyone have samples of coding a progress bar for a splash screen.
-
Does anyone have samples of coding a progress bar for a splash screen.
-
Does anyone have samples of coding a progress bar for a splash screen.
Like eg_Anubhava suggested, I have a program with a form setup as a splash type of screen and it has a progressbar on the form and a timer with the interval set to 500. Here is the code I used.
Dim intProgressValue As Integer
Private Sub frmReportSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
intProgressValue = 0
End SubPrivate Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
.
.
.
intProgressValue += 2
If intProgressValue > 100 Then
intProgressValue = 5
End If
Me.ProgressBar.Value = intProgressValue
End SubHope this helps... :)
Lost in the vast sea of .NET
-
Does anyone have samples of coding a progress bar for a splash screen.
What, precisely, is the bar measuring the progress of? That is going to have an impact as to how you code your solution. If it is just a timer -- the splash screen will be visible for 10 second and then go away -- you can use a timer. If you are actually displaying the progress of your application's start-up, though, you will need to do some planning. Set your bar to have a minimum of 0 and a maximum of 100. Then look at everything that the set-up does: read the registry and set variables, locate network resources, manually load libraries, verify user credentials, and so on. Assign each individual step a percentage of your maximum, and reset the bar's value after each step. You might also want to add a status bar at the bottom of the splash to give text feedback.
Private Sub UpdateProgress(ByVal Text As String, ByVal Increment As Integer) ToolStripStatusLabel1.Text = Text ToolStripProgressBar1.Value += Increment StatusStrip1.Invalidate() End Sub Public Sub Main() ToolStripProgressBar1.Minimum = 0 ToolStripProgressBar1.Maximum = 100 ToolStripProgressBar1.Value = 0 UpdateProgress("Verifying user credentials...", 20) {code} UpdateProgress("Locating network resources Alpha...", 10) {code} UpdateProgress("Locating network resources Beta...", 10) {code} UpdateProgress("Locating network resources Gamma...", 10) {code} UpdateProgress("Verifying current version...", 25) {code} UpdateProgress("Loading MyLib1.dll...", 5) {code} UpdateProgress("Loading MyLib2.dll...", 5) {code} UpdateProgress("Loading MyLib3.dll...", 5) {code} UpdateProgress("Finalizing...", 10) {code} Me.Close() End Sub
When the splash screen closes, the app's main form will launch.
-
Like eg_Anubhava suggested, I have a program with a form setup as a splash type of screen and it has a progressbar on the form and a timer with the interval set to 500. Here is the code I used.
Dim intProgressValue As Integer
Private Sub frmReportSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
intProgressValue = 0
End SubPrivate Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
.
.
.
intProgressValue += 2
If intProgressValue > 100 Then
intProgressValue = 5
End If
Me.ProgressBar.Value = intProgressValue
End SubHope this helps... :)
Lost in the vast sea of .NET
Why not just set the progressBar to
Style
property toMarquee
? That would save all that coding for the same effect.Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.
-
Why not just set the progressBar to
Style
property toMarquee
? That would save all that coding for the same effect.Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.
Didn't know that style existed. I tested it out and yes it basically does the same thing. I'll use that style next time I want a progressbar for just the visual effect. Like TechBearSeattle said, I'm not sure if Daniel Engelkes wanted a visual type of effect or was looking for a progress bar to actually show progress of a certain process. Thanks! :)
Lost in the vast sea of .NET