PRB: Slider--Behavior of ClearSel/SelectRange

Last reviewed: February 9, 1996
Article ID: Q145684
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

After using the Slider control's ClearSel method, the SelStart property is set to -1. According to the Visual Basic documentation and to the online help, the SelStart property should be identical to the Value property after using the ClearSel method. In this case, the documentation is incorrect.

RESOLUTION

Depending on what is done with the Slider control, the effect of this conduct will vary. Write code that takes this behavior into account.

Be sure to remember that this also means that you can't assume that SelStart will always remain between the Min and Max properties of the Slider control.

STATUS

This behavior is by design.

MORE INFORMATION

  1. Start Visual Basic.

  2. From the File menu, choose New Project.

  3. Double-click the Slider button in the Toolbox to add a Slider control to your project.

  4. Change the SelectRange property of Slider1 to True.

  5. From the Run menu, choose Start (ALT, R, S) or press F5 to start the application. Immediately press CTRL+BREAK, select Break from the Run menu, or press the Pause button on the toolbar to pause execution.

  6. The following lines of code will select a range in the Slider control. Type them on separate lines in the Debug window.

    Slider1.SelStart = 2 Slider1.SelLength = 3

  7. After visually verifying that the correct range is selected in the slider control, invoke the slider's ClearSel method by typing the following in the Debug window:

    Slider1.ClearSel

  8. Examine the SelStart property of the slider by typing

    Print Slider1.SelStart

    in the Debug window.

    According to the documentation, this should return a 0, because the Value property of the slider is 0 by default and has not been changed. However, it instead returns a value of -1.


Additional reference words: 4.00 vb4win vb432 slider
KBCategory: kbprg
KBSubcategory: PrgCtrlsCus


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: February 9, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.