BUG: Progress Bar Does Not Paint When DragMode Automatic

Last reviewed: October 16, 1996
Article ID: Q150219
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 32-bit only, for Windows, version 4.0

SYMPTOMS

If the DragMode property of the Microsoft Windows 95 Progress Bar control is set to 1-Automatic, it does not paint if the progress of the control is updated.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

Set DragMode to 0-Manual before progress is updated, and then reset it to 1- Automatic after the control has had time to paint.

Instead of updating the value directly, the following subroutine can be called to update the value. The first parameter is the control itself and the second parameter is the new value for the progress:

   Public Sub UpdateProgress(ProgBar As Object, NewValue As Integer)
      'Turn drag to Manual briefly.
      ProgBar. Value = 0
      'Update the progress.
      ProgBar.Value = NewValue
      'Turn drag to Automatic, and allow time for repaint.
      ProgBar.DragMode = 1
      DoEvents
   End Sub

MORE INFORMATION

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Place a progress bar control on Form1. Change the DragMode property to 1-Automatic.

  3. In the Click event of Form1, place the following code:

          Private Sub Form_Click()
    
             For i = 1 To 10
                ProgressBar1.Value = ProgressBar1.Value + 10
             Next i
          End Sub
    
    

  4. Run the project by pressing the F5 key. Click the form, and note that nothing happens. If DragMode was initially set to 0-Manual, then progress is shown until the bar fills.

To work around the problem above, include the UpdateProgess subroutine in the code of Form1, and modify the Click event of the Form to the following:

   Private Sub Form_Click()
      For i = 1 To 10
         UpdateProgress ProgressBar1, ProgressBar1.Value + 10
      Next i
   End Sub


Additional reference words: 4.00 vb4win vb432 buglist4.00
KBCategory: kbprg kbbuglist
KBSubcategory: PrgCtrlsStd



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 16, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.