Altaf Patni
asked on
How to reject delete key from datacombo
Hi
i am using following code, to just select text from datacombo. but delete key still working..
i wanted to reject delete key .. Please assist me.
i am using following code, to just select text from datacombo. but delete key still working..
i wanted to reject delete key .. Please assist me.
Private Sub Check_Arrow(ByRef code As Integer)
Select Case code
Case 37 To 40 ' arrow keys are ok
Case Else ' Reject any other key.
code = 0
End Select
End Sub
What code areyou passing th that funciton?
ASKER
Private Sub cb_city1_KeyPress(KeyAscii As Integer)
MsgBox KeyAscii
Call Check_Arrow(KeyAscii)
end sub
where are you getting the keycode???
Replace with
Private Sub cb_city1_KeyPress(KeyAscii As Integer)
if KeyAscii <> 46
Call Check_Arrow(KeyAscii)
else
KeyAscii = 24
endif
end sub
Private Sub cb_city1_KeyPress(KeyAscii
if KeyAscii <> 46
Call Check_Arrow(KeyAscii)
else
KeyAscii = 24
endif
end sub
ASKER
tried but delete key still working..
i want to prevent user to use delete key or delete contain from datacombo
i want to prevent user to use delete key or delete contain from datacombo
datacombo or combobox binded to data???
Try this
Private Sub cb_city1_KeyPress(KeyAscii As Integer)
If KeyAscii = 46 Then
' "Cancel" the keystroke
KeyAscii = 0
else
Call Check_Arrow(KeyAscii)
End If
end sub
Private Sub cb_city1_KeyPress(KeyAscii
If KeyAscii = 46 Then
' "Cancel" the keystroke
KeyAscii = 0
else
Call Check_Arrow(KeyAscii)
End If
end sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.