in vb6 classic. please
I need to add a slider in form tath automaticlly set the step min and max based the number of day of current month is this possible?
and.... during move the cursor, automaticlly, show in a label the value of day of current idex of cursor
SLIDER based date month
-
- Administrator
- Posts: 78790
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SLIDER based date month
Let's say you have a scroll bar ScrollBar1 and a label Label1.
In the On Load event of the form, to initialize the scroll bar:
In the On Change event of the scroll bar:
In the On Load event of the form, to initialize the scroll bar:
Code: Select all
Private Sub Form_Load()
With Me.ScrollBar1
.Min = 1
.Max = Day(DateSerial(Year(Date), Month(Date) + 1, 0))
.Value = Day(Date)
End With
End Sub
Code: Select all
Private Sub ScrollBar1_Change()
Me.Label1.Caption = Me.ScrollBar1.Value
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4402
- Joined: 26 Apr 2010, 17:36
Re: SLIDER based date month
Sorry but not SCROLLBARR but a SLIDERBARHansV wrote:Let's say you have a scroll bar ScrollBar1 and a label Label1.
In the On Load event of the form, to initialize the scroll bar:
In the On Change event of the scroll bar:Code: Select all
Private Sub Form_Load() With Me.ScrollBar1 .Min = 1 .Max = Day(DateSerial(Year(Date), Month(Date) + 1, 0)) .Value = Day(Date) End With End Sub
Code: Select all
Private Sub ScrollBar1_Change() Me.Label1.Caption = Me.ScrollBar1.Value End Sub
-
- Administrator
- Posts: 78790
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SLIDER based date month
I don't have the slider control since I don't have VB6, but it should work EXACTLY the same as a scroll bar. Simply use the name of the slider control instead of ScrollBar1.
Best wishes,
Hans
Hans