Click to See Complete Forum and Search --> : keyascii


January 5th, 2000, 04:56 PM
when i enter the code in List1.Keypress

if keyascii = 68 then list1.removeitem (list1.listindex);

if the user hits D then the selected item is removed.
when I do it with delete, however:

if keyascii = 46 then list1.removeitem (list1.listindex)

when they press DELETE nothing happens! What is the code>?

Aaron Young
January 5th, 2000, 09:14 PM
Use the KeyDown Event instead and use the VB constants, ie.

private Sub List1_KeyDown(KeyCode as Integer, Shift as Integer)
If List1.ListIndex > -1 then
If KeyCode = vbKeyDelete then
List1.RemoveItem List1.ListIndex
End If
End If
End Sub




Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com