Results 1 to 3 of 3

Thread: ProgressBar, Please help me

  1. #1


    i want to display a ProgressBar while read a table. i'm using ProgressBar (mscomctl.ocx.


  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Southeastern MI
    You could do something like this:

    Dim inc As Double
    Dim NumOfIterations As Integer
    inc = 0
    ProgressBar1.Value = 0
    NumOfIterations = 12000
    inc = 100 / NumOfIterations
    For x = 1 To NumOfIterations
      If ProgressBar1.Value + inc < 100 Then
        ProgressBar1.Value = ProgressBar1.Value + inc
        If ProgressBar1.Value Mod 5 = 0 Then
        End If
        ProgressBar1.Value = 100
      End If
    This code increments the Progressbar based on the number of iterations you have for your loop. Basically for your problem you will want to figure out how many iterations you have and then calculate your increment. Once you have your increment you just increment your progress bar each time through the loop. The
        If ProgressBar1.Value Mod 5 = 0 Then
        End If
    Only refreshes the screen twenty times, because refreshing is a costly process.

  3. #3
    Addicted Member ender_pete's Avatar
    Join Date
    Aug 2000
    Virginia, United States
    what do you want the progressbar to do?
    do you want to the progressbar to track the progress
    of the table loading to a recordset, or the progress of filling a recordset... be more specific....

    here is code to a form i use as a global status indicator
    all i do is load the form set the variables in the form and then call the changevalue function on the form...
    use the increment function if you want to increment
    a certain multiple of times

    Public strProcess As String
    Public sglTotalValue As Single
    Public sglStep As Single

    Public Sub Form_GetStepValue(lngTotalValue As Long)

    If lngTotalValue <= 0 Then lngTotalValue = 1
    sglStep = 32767 / lngTotalValue
    End Sub

    Public Sub Form_ChangeValue()

    sglTotalValue = sglTotalValue + sglStep
    If sglTotalValue <= 32767 Then _
    SBar.Value = CInt(sglTotalValue)
    End Sub

    Public Sub Form_Increment(lngSpecInc As Long)

    sglTotalValue = sglTotalValue + sglStep * lngSpecInc
    If sglTotalValue <= 32767 Then _
    SBar.Value = CInt(sglTotalValue)
    End Sub

    C#,VS.NET Ent Arch, vb6 ee sp5,html,vbscript,jscript,
    xml,dhtml,delphi,c++,vc++,java,cgi,php, python, ada(so ancient) ,adasage(also ancient) and others i can't remember.....

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