Results 1 to 3 of 3

Thread: ProgressBar, Please help me

  1. #1
    Guest

    Question

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

    TIA

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

    Code:
    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
         Me.Refresh
        End If
      Else
        ProgressBar1.Value = 100
      End If
    Next
    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
    Code:
        If ProgressBar1.Value Mod 5 = 0 Then
         Me.Refresh
        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
    Location
    Virginia, United States
    Posts
    131
    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

    ender_pete
    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