I have a very simple -albeit frustrating- question today. I need to have an If statement that runs code only if the user has pressed a certain key. How do I do that? I have the Keypress sub already made:
Private Sub PictureBox1_KeyPress(sender As Object, e As EventArgs) Handles ClickField1.KeyPress
If KeyPressed = Z Then
'Run Code
Else
Return
End If
What's the 'If KeyPressed = Z Then' proper syntax? Thanks in advance!
There are multiple ways, here's something for a start.
If e.KeyChar.ToString.ToLower.Equals("z") Then 'Both z and Z
'Something
End If