I am working on my first vb app and have run into a stickler.
I have a form frmCalculator. This form is a calculator that allows for numbers and operations to be entered either by clicking on the buttons in the form or by keystroke. I do not want to require focus in the number display text field in order for the user to use they keyboard to enter number.
I tried using the following as a test, but when I hit a key, the message popup display doesn't appear.
I tried different renditions of the code below as well as the code after.
and also
ICQ: 54380631
I have a form frmCalculator. This form is a calculator that allows for numbers and operations to be entered either by clicking on the buttons in the form or by keystroke. I do not want to require focus in the number display text field in order for the user to use they keyboard to enter number.
I tried using the following as a test, but when I hit a key, the message popup display doesn't appear.
I tried different renditions of the code below as well as the code after.
Code:
Private Sub frmCalculator_KeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
Select Case sender
Case 37 'Left arrow
MessageBox.Show("left")
Case 38 'Up arrow
MessageBox.Show("up")
Case 39 'Right arrow
MessageBox.Show("right")
Case 40 'Down arrow
MessageBox.Show("down")
End Select
End Sub
and also
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 37 'Left arrow
imgMain.Left = imgMain.Left - 40
Case 38 'Up arrow
imgMain.Top = imgMain.Top - 40
Case 39 'Right arrow
imgMain.Left = imgMain.Left + 40
Case 40 'Down arrow
imgMain.Top = imgMain.Top + 40
End Select
End Sub
ICQ: 54380631