View Single Post
  #4 (permalink)  
Old November 25th, 2008, 12:13 PM
AVPimbleSr AVPimbleSr is offline
Registered User
Join Date: Nov 2008
Location: Bronx, NY, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

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?


quote:Originally posted by langsha

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

Reply With Quote