Windows Develop Bookmark and Share   
 index > Windows Forms General > numericupdown detect down arrrow button for negative direction
 

numericupdown detect down arrrow button for negative direction

click?

Right now I have;

Private Sub numericUpDown_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles numericUpDown.Click

Dim iValue As Integer

iValue = CInt(Me.numericUpDown.Value)

numericUpDown.Text = CStr(iValue)

How do I have it decrement and show negative numbers when clicking on the down arrow and then positive on the up arrow?

Thank you.

-greg

hazz  Friday, March 30, 2007 10:37 PM
There is no need for your Click event, NUD does it automatically. To allow for negative numbers, set the Minimum property to a value less than zero.
nobugz  Saturday, March 31, 2007 8:04 AM

Private Sub numericUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numericUpDown_Speed.ValueChanged

Try

iNumericUpDownValue = Me.numericUpDown_Speed.Value

If iNumericUpDownValueOld > iNumericUpDownValue Then

iNumericUpDownValue = iNumericUpDownValue - 1

Else

iNumericUpDownValue = iNumericUpDownValue + 1

End If

LoadedTracks_ModifySpeedFactor(iNumericUpDownValue)

iNumericUpDownValueOld = iNumericUpDownValue

Catch ex As Exception

MessageBox.Show("numericUpDown_ValueChanged exception = " + ex.ToString)

End Try

End Sub

hazz  Friday, March 30, 2007 11:29 PM
There is no need for your Click event, NUD does it automatically. To allow for negative numbers, set the Minimum property to a value less than zero.
nobugz  Saturday, March 31, 2007 8:04 AM
Thank you!
hazz  Monday, April 02, 2007 4:07 PM

You can use google to search for other answers

Custom Search

More Threads

• Client Server Chat application using Winforms
• Create my own Custome DataGridViewRowheader cell class
• Saving and retrieving Font object
• problem in dynamic menus
• call instance of main form
• Simulating taskbar behavior with a form
• how can we catch the Exception for eachline without try catch block on each line....C# ?
• datagridview not showing scroll & backgroundworker taking time to show gui
• BACKGROUND WORKER problem
• Basic WebBrowser question