Skip to content

Instantly share code, notes, and snippets.

@facebookegypt
Created February 4, 2014 13:13
Show Gist options
  • Save facebookegypt/8803339 to your computer and use it in GitHub Desktop.
Save facebookegypt/8803339 to your computer and use it in GitHub Desktop.
VB 2010 Progress Bar
'Visual Basic Online Course
'VB 2010 Progress Bar
'Place this code in the Module section
Module Module1
Public ProBar1 As ProgressBar = New ProgressBar
End Module
'Place this code in your form [Form1]
Public Class Form1
Private Sub Form1_Click(sender As Object, _
e As System.EventArgs) Handles Me.Click
' Display the ProgressBar control.
ProBar1.Visible = True
' Set Minimum to 1 to represent the first file being copied.
ProBar1.Minimum = 1
' Set Maximum to the total number of files to copy.
ProBar1.Maximum = 100
' Set the initial value of the ProgressBar.
ProBar1.Value = 1
' Set the Step property to a value of 1 to represent each file being copied.
ProBar1.Step = 1
' Loop through all files to copy.
Dim x As Integer
For x = 1 To 100 - 1
' Copy the file and increment the ProgressBar if successful.
If x <= 100 Then
' Perform the increment on the ProgressBar.
ProBar1.PerformStep()
End If
Next x
End Sub
Private Sub Form1_Load(sender As System.Object, _
e As System.EventArgs) Handles MyBase.Load
ProgressBar1 = ProBar1
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment