FIX: Scroll Bar Thumb Doesn't Do Change Event as It Should

Last reviewed: October 30, 1997
Article ID: Q96798
2.00 WINDOWS kbenv kbbuglist

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, version 2.0

SYMPTOMS

A Change event is generated when Visual Basic code sets a scroll bar's Value property. However, if the user then drags the thumb (scroll box) on the scroll bar to either its minimum or maximum value, a change event should occur but may not. The change event is generated correctly when the thumb on the scroll bar is dragged to any point other then its minimum or maximum after Visual Basic code sets the Value property.

STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic version 2.0 for Windows. This problem was corrected in Microsoft Visual Basic version 3.0 for Windows.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Visual Basic or from the File menu, choose New Project (ALT, F, N) if Visual Basic is already running. Form1 is created by default.

  2. Add a horizontal scroll bar (HScroll1) to Form1.

  3. Add a label (Label1) to Form1.

  4. Add a command button (Command1) to Form1.

  5. Add the following code to Form1's Form_Load event procedure:

       Sub Form_Load ()
          Form1.Show
          HScroll1.Value = 1
          HScroll1.Min = 1
          HScroll1.Max = 100
       End Sub
    
    

  6. Add the following code to the Command1_Click event procedure:

       Sub Command1_Click ()
          HScroll1.Value = HScroll1.Max
       End Sub
    
    

  7. Add the following code to the HScroll1_Change event procedure:

       Sub HScroll1_Change ()
          Label1.Caption = Str$(HScroll1.Value)
       End Sub
    
    

  8. From the Run menu, choose Start (ALT, R, S) to run the program.

  9. Choose the command button. The thumb on the scroll bar correctly moves to its maximum position and the label displays the Max property of HScroll1, 100.

  10. Drag and drop the thumb on the scroll bar back to its minimum position.

        The label incorrectly continues to display the Max property for
        HScroll1, 100.  A change event should have occurred in HScroll1 when
        the thumb was dragged back to its minimum position, and the caption
        should have changed to 1. But the change event was not generated.
    


Additional reference words: buglist2.00 fixlist3.00 2.00 3.00
KBCategory: kbenv kbbuglist
KBSubcategory: EnvtRun
Solution Type : kbfix


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 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.