Take advantage the Slider control’s Select Range mode

Take advantage the Slider control’s Select Range mode

The Slider control has a capability that you might ignore: you can assign its SelectRange property to True to enter Select Range mode, during which the user can use the Slider to select a range instead of a single value. When in Select Range mode, however, it’s up to you to manage the SelStart and SelLength properties, and you have to ensure that SelStart is always positive.

The following code sample shows how you can enter Select Range mode when the user moves the mouse while pressing the Shift key:

' Enter Select Range mode when the user moves the mouse while keeping the SHIFT ' key pressedPrivate Sub Slider1_MouseDown(Button As Integer, Shift As Integer, x As Single, _    y As Single)    ' if the shift key is being pressed, enter Select Range mode    If Shift = vbShiftMask Then        Slider1.SelectRange = True        Slider1.SelLength = 0        ' remember current position in Tag property        Slider1.Tag = Slider1.Value    Else        Slider1.SelectRange = False    End IfEnd Sub' modify the selected range when the user moves the Slider's indicatorPrivate Sub Slider1_Scroll()    If Slider1.SelectRange Then        ' get initial value        Dim StartSelection As Single        StartSelection = Val(Slider1.Tag)        ' if the indicator is being moved in SelectRange mode, you must        ' discern between two cases        If Slider1.Value > StartSelection Then            Slider1.SelStart = StartSelection            Slider1.SelLength = Slider1.Value - StartSelection        Else            Slider1.SelStart = Slider1.Value            Slider1.SelLength = StartSelection - Slider1.Value        End If    End IfEnd Sub

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular