Results 1 to 6 of 6

Thread: BackSpace problem

  1. #1
    Guest

    Angry

    Hi there.

    I have a problem, here is my code:

    Code:
    Private Sub Grid1_KeyPress(KeyAscii As Integer)
        Grid1.Text = Grid1.Text & Chr(KeyAscii)    
    End Sub
    every time i press the backspace button "chr(8)" it ads an vertical bar insted of erasing the last charecter, can someone help me out?

    numibesi

  2. #2
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Code:
    Private Sub Grid1_KeyPress(KeyAscii As Integer)
        If KeyAscii > 31 then Grid1.Text = Grid1.Text & Chr(KeyAscii)    
    End Sub
    This will allow all control characters

  3. #3
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372

    Hmm

    You'll probably also need this:

    Code:
    If KeyAscii = 8 then 
     Grid1.Text = Left(Grid.Text,Len(Grid1.Text) - 1)
    End If

  4. #4
    Guest

    Angry Thatīs not he problem

    The problem is that when i need to erase the last imputed character using the Backspace button it doesnīt work using your code, or it imputs an vertical bar charater using my code.

    numibesi

  5. #5
    Guest

    Talking Sorry

    Sorry marnitz,

    it does work now thank you marnitz, i was replying at the time so i didinīt saw your post. Thx

    numibesi

  6. #6
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    No prob. Enjoy!

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