CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: keyascii

  1. #1
    Guest

    keyascii

    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>?


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: keyascii

    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
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

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

Featured