SOLUTION: UpDown Control - scrolling in odd intervals 
Author Message
 SOLUTION: UpDown Control - scrolling in odd intervals

If you have questions about this code, please email me, as I may not see your
questions in the newsgroup before they scroll off.

John Ellard

Sample code of a textbox's value being scrolled by a fractional interval, using
the mouse and the UpDown control:

Private Sub udDuration_Change()
'PURPOSE:   Increments and decrements the value of the Activity's Duration
'           in .25 intervals, including scrolling the value up and down when the
'           mouse button is held down while on the up or down button.

'NOTE:  Because the UpDown control imposes the restriction of non-fractional
'             Intervals, the textbox CANNOT be a Buddy control to the UpDown
'            control.

'Storage for the last value before the user changed it.
Static slValue              As Long

'Flag indicating which way to scroll the Duration.
Dim fScrollDirection        As Integer

'Determine which way to scroll the textbox value.
    If udDuration.Value > slValue Then
        fScrollDirection = 1           'Scroll up
        fScrollDirection = 2           'Scroll down
    End If

'Update the duration of time for the selected activity.
    With txtDuration
        Select Case fScrollDirection
            Case 1
                If IsNumeric(.Text) Then
                    .Text = CSng(.Text + 0.25)
                    .Text = "0"
                End If
            Case 2
                If IsNumeric(.Text) Then
                    .Text = CSng(.Text - 0.25)
                    If CSng(.Text) < 0 Then
                        .Text = "0"
                    End If
                    .Text = "0"
                End If
        End Select
    End With

'Resynchronize the test value for the next time this event is entered.
    slValue = udDuration.Value
End Sub

John Ellard

Fri, 29 Mar 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. UpDown Control - Scrolling in .25 Intervals

2. UpDown-Control as a constituent control for a UserControl not working

3. UpDown control (aka spin control)

4. Connecting a user control to a Textfield - like the updown-control

5. Solution: Problem with RTF (RichTextFormat) scrolling position...

6. Scrolling forms (problem with KB Solution)

7. Tree View scroll solution.

8. updown controls clicked

9. Updown control buttons clicked

10. The UpDown Control

11. UpDown Control Button

12. UpDown control


Powered by phpBB® Forum Software