Results 1 to 4 of 4

Thread: using key ascii's

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    Galt, Ca
    Posts
    47
    i am making a program that when you type in a word, and press ok, it displays the word in wierd text... i.e. Æ,à,Û
    anyways, i made it so when you enter a character into a text box (Text1) it gets the ascii # and then sends an according character to the second text box (text2). But i can't figure out how to make it do a backspace. when you push backspace, it deletes the last character put into text1, but it leaves it there in text2...

    for instance, you put this into text1.. "hello" and you hit backspace between the after the o because you accidentally hit p or something... in text1 it will read "hello" but in text2, it will read "hellpo"

    if you can help me i would really appreciate it

    thanx for the help!

    emptywords


    p.s. where you guys from? i'm from northern california, about 40 miles north of sacramento, (the capital city)

    thanx!

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    You have to do it in code. in your key handling code put this

    [CODE]
    'if user has pressed backspace.
    If KeyAscii=8 Then

    'Cut off last character of text 2
    text2.text= Right$(Text2.Text,Len(Text2.Text)-1)


    'Otherwise add key
    Else

    Text2.Text=Text2.Text & WierdChr$(KeyAscii)

    End If

    'put caret at end of text
    Text2.Selstart=Len(Text2.Text)

    Where wierdChr$ is your function that returns a strange character from an ascii code

    Hope this helps

    [Edited by Sam Finch on 03-25-2000 at 06:34 AM]

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    Galt, Ca
    Posts
    47

    more ascii help

    Thank you! that works great... dispite one problem. when i push the backspace key, the textbox loses focus. In other words... the blinking cursor is no longer in the text box, so everytime you push backspace, you have to click back in the text box.

    thank you for your help!

    emtpywords

  4. #4
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    Hi,

    Just a little nudge on the code

    [code]If KeyAscii=8 Then
    'Cut off last character of text 2
    text2.text= Left$(Text2.Text,Len(Text2.Text)-1)
    text1.SetFocus 'move focus back to the first textbox


    'Otherwise add key
    Else
    'and so forth
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width