Microsoft KB Archive/251321

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 251321

Article Last Modified on 6/24/2004



APPLIES TO

  • Microsoft Visual Basic 4.0 Standard Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 Professional Edition
  • Microsoft Visual Basic 4.0 16-bit Enterprise Edition
  • Microsoft Visual Basic 4.0 32-Bit Enterprise Edition



This article was previously published under Q251321

SYMPTOMS

In Microsoft Visual Basic, the intrinsic HScrollBar and VScrollBar controls experience painting problems if the mouse is moved off the control prior to the completion of code execution in the Change event.

RESOLUTION

To work around this behavior, the scrollbar control can be disabled at the start of the Change event. Once the code execution is complete, the control can then be enabled again.

Private Sub HScroll1_Change()
   HScroll1.Enabled = False

   ' place your code here 

   HScroll1.Enabled = True
End Sub
                

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Visual Basic Standard EXE project. Form1 is created by default.
  2. Add an HScrollBar control to Form1.
  3. Add the following code to the General Declarations section of Form1:

    Private Sub HScroll1_Change()
        t = Timer
        While Timer < (t + 2)  ' to give you time to move the mouse
            DoEvents
        Wend
    End Sub
                        
  4. Press the F5 key to run the program.
  5. Click on the RIGHT ARROW of the HScrollBar control. Note that the RIGHT ARROW appears in a depressed state.
  6. Before the RIGHT ARROW of the HScrollBar returns to the raised state, move the mouse off the HScrollBar control and position the mouse over any portion of the client area of Form1.
  7. When the RIGHT ARROW of the HScrollBar returns to the raised state, click once on the HScrollBar thumb. Note that the thumb receives focus and begins flashing.
  8. Drag the HScrollBar thumb to the the right side of the control. Note that both the RIGHT and LEFT ARROWs of the HScrollBar control are now selected and in a depressed state.


Keywords: kbbug kbnofix kbscrollbar kbctrl KB251321