KeyAscii is the Ascii value for the key you pressed while in your textbox named txt_String. The KeyPress event tracks each time you press a key, hence the name.
You are receiving the error "Invalid procedure call or argument" because you are providing an invalid argument to the Asc() function. The Asc() function takes a single text character. You can only get the Ascii value of a single character.
That being said, what are you trying to accomplish?
Allan
Quote:
quote:Originally posted by langsha
Hi,
I'm new to this site and am hoping someone can help. I'm trying to find the ascii value of text entered into a text box. I've written the following code on the Key press event of a text box, but every time I type something in, I get a "Invalid procedure call or argument" error. Do I need to have a specific reference turned on or is there an issue with my code?
Thanks in advance for your help!
Private Sub txt_String_KeyPress(KeyAscii As Integer)
Dim Asc_Value As String
Asc_Value = Asc(Me.txt_String.Text)
MsgBox Asc(Asc_Value)
End Sub
--LANGSHA--
|