character recognition

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HillyBilly
    New Member
    • May 2010
    • 3

    character recognition

    I am making a small and very simple game that is ment to help children learn to recognise letters. I have come to a stop as I have 3 text fields. When something is entered into the first field, the program will set focus to the next text field.

    The problem is when the child tries to delete a character from a previous field as the focus is already set to the next text field. I want it to delete the character from the previous field when the backspace bar is hit. Any suggestion how this might be done?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Override the Keypress event in textbox2.
    When a key is pressed, have that method affect the text in textbox1

    Comment

    • HillyBilly
      New Member
      • May 2010
      • 3

      #3
      I'm really new still to vb so what is the code for pressed.

      If "" = Chr(8)

      this is what I got so far but I'm not sure what to put in the ""

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        huh?

        Show us the code you are actually using.

        Comment

        • HillyBilly
          New Member
          • May 2010
          • 3

          #5
          This is the code that is in textbox2

          Code:
                  txtsecond.CharacterCasing = CharacterCasing.Upper
                  txtsecond.MaxLength = 1
                  txtthird.Focus()
                  If [U](missing code)[/U]  = Chr(8) And txtsecond.TextLength = 0 Then
                      txtfirst.Clear()
                  End If

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            in the line at the start of the sub (that you didn't show) is an arguement for the keypress. You get the information of *which* key was pressed out of that argument. How about updating the code you posted to include the entire method including the KeyPressArgs e portion?

            If you start typing...

            if ( e.

            After you hit the period Intellisense will show you the visible methods and variable of the KeyPressArgs e - one of them should be the KeyChar or KeyCode ... something like that ... that you can use.

            Comment

            Working...