Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. progress bar

progress bar

Scheduled Pinned Locked Moved Visual Basic
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniel Engelkes
    wrote on last edited by
    #1

    Does anyone have samples of coding a progress bar for a splash screen.

    L K G 3 Replies Last reply
    0
    • D Daniel Engelkes

      Does anyone have samples of coding a progress bar for a splash screen.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What you want to done with Progress bar. Use timer in splash and increse the value of progress bar in timer.tick for how many times you want to run splash. then close the form.

      If you can think then I Can.

      1 Reply Last reply
      0
      • D Daniel Engelkes

        Does anyone have samples of coding a progress bar for a splash screen.

        K Offline
        K Offline
        KreativeKai
        wrote on last edited by
        #3

        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 Sub

        Private 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 Sub

        Hope this helps... :)

        Lost in the vast sea of .NET

        S 1 Reply Last reply
        0
        • D Daniel Engelkes

          Does anyone have samples of coding a progress bar for a splash screen.

          G Offline
          G Offline
          Gregory Gadow
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • K KreativeKai

            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 Sub

            Private 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 Sub

            Hope this helps... :)

            Lost in the vast sea of .NET

            S Offline
            S Offline
            Steven J Jowett
            wrote on last edited by
            #5

            Why not just set the progressBar to Style property to Marquee? 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.

            K 1 Reply Last reply
            0
            • S Steven J Jowett

              Why not just set the progressBar to Style property to Marquee? 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.

              K Offline
              K Offline
              KreativeKai
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups