Home > How-To Library > Controls

How to allow users to increase and decrease the value using Up and Down arrow keys in a text box

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp Text1.Text = CDbl(Text1.Text) + 1 Case vbKeyDown Text1.Text = CDbl(Text1.Text) - 1 End Select End Sub

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.