Results 1 to 7 of 7

Thread: [RESOLVED] displaying a progress bar on a status bar doesn't seem to work

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] displaying a progress bar on a status bar doesn't seem to work

    i have a control that i can display on a statusbar
    now each time i refresh the table i need this progressbar to count the records from the table
    how ever everytime i refresh it seems that the progressbar reaches to the end before it counts
    and i have like 2000 records to count.
    dont know what is the problem
    this is the code i am using
    Code:
    Public Sub ReloadTheDataBase()
        
       FrmMainMenu.MousePointer = vbHourglass
       FrmMainMenu.RibbonEnabled False
       Dim ProgressPane As StatusBarProgressPane
     Set ProgressPane = FrmMainMenu.CommandBars.StatusBar.FindPane(ID_ProgressBarOnStatusBar)
       FrmMainMenu.CommandBars.StatusBar.FindPane(ID_PRGTEXT).Visible = True
       ProgressPane.Visible = True
       LoadYomanAppointments
    End Sub
    
    Sub LoadYomanAppointments()
    
       Dim ProgressPane As StatusBarProgressPane
     Set ProgressPane = FrmMainMenu.CommandBars.StatusBar.FindPane(ID_ProgressBarOnStatusBar)
       FrmMainMenu.CommandBars.StatusBar.FindPane(ID_PRGTEXT).Visible = True
       ProgressPane.Visible = True
       ProgressPane.Value = 1
       Set rs = CN.Execute("select * from Event")
       ProgressPane.Max = rs.RecordCount
       Do While Not rs.EOF
       ProgressPane.Value = ProgressPane.Value + 1
       DoEvents
       rs.MoveNext
       Loop       
    End Sub
    any help will be appreciated
    regards salsa31

  2. #2
    Lively Member
    Join Date
    Oct 2013
    Posts
    124

    Re: displaying a progress bar on a status bar doesn't seem to work

    I don't see anything wrong with that code. The only suggestion I have is that you might want to try the APIDoEvents instead of the plain VB one. I have no idea whether it will make a difference or not, but it might help. If you don't have APIDoEvents, the source code is a free download on Planet Source Code.
    AMD FX-4300, WinXPSP3, VB6SP6

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: displaying a progress bar on a status bar doesn't seem to work

    when i tried and tested this progressbar with a timer it worked great
    but when i refresh the system it loads the prgbar but all the way to the end instead of calculating it by the
    records in the table
    this is a sample of the prgbar with a timer that is working
    Code:
      Dim ProgressPane As StatusBarProgressPane
        Set ProgressPane = frmMain.CommandBars.StatusBar.FindPane(ID_INDICATOR_PROGRESS)
      ProgressPane.Visible = True
        ProgressPane.Value = ProgressPane.Value + 1
        If ProgressPane.Value >= 100 Then
            ProgressPane.Value = 0
            Timer.Enabled = False
        End If
    Code:
    Private Sub MDIForm_Load()
       Dim ProgressPane As StatusBarProgressPane
        Set ProgressPane = StatusBar.AddProgressPane(ID_INDICATOR_PROGRESS)
        ProgressPane.Value = 0
        ProgressPane.Width = 100
        ProgressPane.Visible = False
    Last edited by salsa31; Apr 8th, 2014 at 08:33 AM.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,905

    Re: displaying a progress bar on a status bar doesn't seem to work

    I think it's going to fast to see the update.
    Looping through 2000 records only takes a fraction of a second.

    Also have you set the progressbar min and max values.
    By default it works with percentages, so after value = 100 there won't be any updates anymore

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: displaying a progress bar on a status bar doesn't seem to work

    i added 10000 records for the test still the same thing
    it is like starting from the max instead of the min
    dont know realy strange

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: displaying a progress bar on a status bar doesn't seem to work

    just replaced the control
    everything ok
    tnx for the help

  7. #7
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Re: displaying a progress bar on a status bar doesn't seem to work

    try the following way . hope it might help .
    Code:
      Dim ProgressPane As StatusBarProgressPane
        Set ProgressPane = frmMain.CommandBars.StatusBar.FindPane(ID_INDICATOR_PROGRESS)
      ProgressPane.Visible = True
        ProgressPane.Value = ProgressPane.Value + 1
        If ProgressPane.Value >= 100 Then
            ProgressPane.Value = 100
            me.caption="Done"
            Timer.Enabled = False
        else
           'write the code where you want to evaluate .because in this case it is enabled .
        End If

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