It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Press a key

Moderator: dafunkymunky

Press a key

Postby valle93 on Tue Sep 16, 2008 2:24 pm

I want to activate a command button by pressing a letter on the keyboard

I´m new at programing and visual basic :oops:
valle93
 
Posts: 0
Joined: Tue Sep 16, 2008 2:17 pm

Postby chubzyko on Thu Sep 18, 2008 1:28 am

if you press the enter key. the button will be enabled, else, you wont be able to click the button.


Code: Select all
Private Sub Command1_Click()
End
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Command1.Enabled = True
End If
End Sub

Private Sub Form_Load()
Command1.Enabled = False
End Sub
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines


Who is online

Users browsing this forum: No registered users and 9 guests