Computer Science Canada

Getting an ascii character

Author:  JSBN [ Sat May 24, 2003 2:16 pm ]
Post subject:  Getting an ascii character

Any one know how i'd go about doing a getch type thing in VB (w/o a promp if possible)?
[/code]

Author:  Tony [ Sat May 24, 2003 4:43 pm ]
Post subject: 

code:

Private Sub Form_KeyPress(KeyAscii As Integer)
Print Chr(KeyAscii)
End Sub

Author:  JSBN [ Sat May 24, 2003 5:35 pm ]
Post subject: 

but that only works when i have it in a program by its self :/

Author:  Tony [ Sat May 24, 2003 8:13 pm ]
Post subject: 

what do you mean?

Author:  JSBN [ Sun May 25, 2003 1:39 pm ]
Post subject: 

nothing happens when i put that code in.... it only seems to work when i put it in it's own seperate program. My program has buttons and other things that i think might interfere with your code's functionallity.

Author:  Tony [ Sun May 25, 2003 1:47 pm ]
Post subject: 

well since its form_keypress you need to have your form active.. click on some empty space...

its also not gonna work if you named your form anything other then form

Author:  JSBN [ Sun May 25, 2003 1:56 pm ]
Post subject: 

well i changed it to Form1_KeyPress......
and it still doesn't work :/

Author:  Tony [ Sun May 25, 2003 5:11 pm ]
Post subject: 

post your files, I'll help you edit it to make it work

Author:  JSBN [ Sun May 25, 2003 5:21 pm ]
Post subject: 

hmm.... because i am not mod here, i cant attatch. i'll just pm them to u k?

Author:  FDisk87 [ Fri Dec 05, 2003 4:51 pm ]
Post subject: 

Make sure the key preview property is set to true on the form designer.


: