How to handle KeyDown in VB.NET -
Ok here's my dilemma here I have this code:
Cacode = key A then text box 1. Updated text ("C,") PictureBox2 Visual = True My computer. Audio. If I enter it under Play Form (Mine Processing C., Audioplaymoda.background), if IF form 1_keydown, Visual Basic thinks: '' AA member is not a keycode system '' EventArgs'
Now I've seen this code work before, but it's not here. Any help?
Here's the full code:
Private sub form 1_keydown (as the object-by-sender, as the system, the Wi-Fi and the system. Windows.Forms. KeyEventArgs) If E. Cacode = Keys.A then text box 1 .Appendext ("A,") PictureBox2.Visible = True My.Computer.Audio.Play (My.Resources.C, AudioPlayMode.Background) End if E. Cacode = keys s. Then text box 1. AppendText ("C,") PictureBox14.Visible = True My.Computer.Audio.Play (My.Rosources.D, AudioPlayMode.Background) End End
< Div class = "post-text" itemprop = "text">
Ensure that you have defined the methodology why e
is declared EventArgs
, but creating the parameters correctly The reason for this type is that there is no property named EventArgs
(naturally) KeyCode
, but KeyEventArgs
does!
Change your event Definition of the handler method for:
Private sub foo_KeyDown (as the sender object, and in the form of keyEventArgs) if e.KeyCode = Keys A. Then TextBox1.AppendText ("A,") PictureBox2. Visible = True My.Computer.Audio.Play (My.Rosources.C, AudioPlayMode.Background) ElseIf e.KeyCode = Keys. Then the text box 1. AppendText ("C,") PictureBox14.Visible = True My.Computer.Audio.Play (My.Resources.D, AudioPlayMode.Background) End End
Comments
Post a Comment