Hi all,
I"m making a small WinForm application in VB.NET. It has 2 textboxes on the
form which can only contain numbers > 0. On the right of each textbox there
are 2 buttons which when pressed increment or decrement the values in the
textboxes.
To make the program more user-friendly I want them to be able to press a
key on the keyboard which in turn will increment or decrement a value. For
example, if they press "a" then TextBoxA will increment, if they press "A"
then TextBoxA will decrement.
Here's what I've got sofar:
Private Sub frm40MMCounter_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = Chr(65) Then
txtA.Text = CInt(txtA.Text) + 1
ElseIf e.KeyChar = Chr(97) Then
txtA.Text = CInt(txtA.Text) - 1
End If
End Sub
I hope someone can help me with this. Thanx in advance!
--
Message posted via http://www.dotnetmonster.com