VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.)

by Patrick Lockefeer (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 23rd July 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.)

API Declarations



'Controls used :

'Frame control Name :Frame1 (put Slider and Label controls on this Frame)
'Slider control Name : SliderChange Properties : Min 0 Max 10
'Label control Name : lblSliderChange


Rate How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.)




Private Function SliderExact()  'Function Name is SliderExact 

Select Case SliderChange 'Name of Slider

Case Is = 0
SliderExact = 0 'Value
Case Is = 1
SliderExact = 0.01
Case Is = 2
SliderExact = 0.02
Case Is = 3
SliderExact = 0.03
Case Is = 4
SliderExact = 0.04
Case Is = 5
SliderExact = 0.05
Case Is = 6
SliderExact = 0.06
Case Is = 7
SliderExact = 0.07
Case Is = 8
SliderExact = 0.08
Case Is = 9
SliderExact = 0.09
Case Is = 10
SliderExact = 0.1

End Select
End Function

'Slider Change event
Private Sub SliderChange_Change()
lblSliderChange = SliderExact  'Call function

'Show value in Frame caption
Frame1.Caption = SliderExact
End Sub

Download this snippet    Add to My Saved Code

How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.) Comments

No comments have been posted about How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.). Why not be the first to post a comment about How to enter Decimal values with a Slider control in a Label (0.01,0.02,0.03 etc.).

Post your comment

Subject:
Message:
0/1000 characters