Results 1 to 1 of 1

Thread: Simple Progress Bar

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,470

    Simple Progress Bar

    Here is a simple progress bar using a Label control.

    Form contains 1 Command button (Command1), 1 Timer (Timer1),
    and 1 label (PBar):
    Alignment = 2 - Center
    Appearance = 0 - Flat
    BackColor = (your choice)
    BackStyle = 1 - Opaque
    BorderStyle = 1 Fixed single
    Caption = {blank)
    Height = 255
    Left = 0
    Width = 15
    Code:
    Option Explicit
    
    Dim PBarInc As Long
    
    Private Sub Command1_Click()
        PBar.Top = Me.ScaleHeight - PBar.Height 'Position at bottom of form
        PBarInc = Me.ScaleWidth / 100 'Determine increment using form width
        PBar.Caption = "Loading"
        Timer1.Enabled = True 'Start
    End Sub
    
    Private Sub Timer1_Timer()
        PBar.Width = PBar.Width + PBarInc
        If PBar.Width >= Me.ScaleWidth Then
            Timer1.Enabled = False
            PBar.Width = 0
        End If
    End Sub
    A Label control will not overlay nongraphical controls such as CommandButton, Checkbox, or ListBox, but can overlay another Label control or graphic object. The download shows the PBar being used over a Status bar Label.

    J.A. Coutts
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width