Text Box Question

Kashif
04-01-2003, 04:58 AM
Private Sub txtFields_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 8 Then
MsgBox "Press Edit Button for Change in Description"
End If
End Sub


I've use this code for checking the Backspace key. But it aslo Delete One Character from that text box also. How can i Prevent from deleteing the Character

Feral
04-01-2003, 05:13 AM
Hi Kashif,

If you test for Key Press asnd then reset the KeyAscii value to 0 you will ignore that Key Press!

Private Sub txtFields_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
KeyAscii = 0 'Resets Key Code
MsgBox "Press Edit Button for Change in Description"
End If
End Sub

Cheers,

Frobozz
04-01-2003, 07:09 AM
You'll also get rid of that annoying beep when pressing enter (or any other key that causes it) if you use KeyAscii = 0 in the code.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum