[2008] Wait for keyboard input
Just a quick question, what is the best way to wait for keyboard input in an application.
For background this is a morse code trainer application and I want it to pause after the morse is sounded to allow the user to input what they think the characters were, once the key has been pressed the next character is then played etc.
I
Re: [2008] Wait for keyboard input
There is no pausing anything. You play a sound, then when the user presses a key you play the next sound. You handle the KeyPress event to detect when the user presses a key.
Re: [2008] Wait for keyboard input
this can be a solution
vb Code:
private str as string = "abc" 'at least two characters in the string
private counter as integer = 0
private sub form_load(Sender as object, e as eventArgs) handles Form1.Load
Sound(str.Chars(counter))
counter += 1
end sub
private textBox1.keyPress(Sender as object, e as ByVal e As System.Windows.Forms.KeyPressEventArgs) handles TextBox1.KeyPress
sound(str.Cahrs(counter))
counter += 1
if counter = str.length then
messageBox.Show("Something")
ens if
end sub