Results 1 to 10 of 10

Thread: Very simple one... listbox

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Lightbulb

    Hi all,

    just a very stupid question:

    I've got a listbox with various entries, I'd just like to delete the selected entries (plural!) when pressing the delete key.

    Better: if someone could actually give me a code for a pop-up menu on right click, with the "delete" option...

    Thank you all in advance,

    W.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    For the first question:
    Put the following code in your program.

    Code:
    Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF2 Then
       If List1.ListIndex <> -1 Then
          List1.RemoveItem List1.ListIndex
       End If
    End If
    End Sub

    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    Thanks!

    Any ideas for the drop down right click menu?
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Cool popup menu

    ok...create a menu with the menu editor.
    for the uppermost level...Uncheck visible
    then add delete ( this one leave visible)

    menu----

    pop
    ---Delete

    pop (name it mnuPop) Uncheck visible
    ---Delete (name it whatever) and leave visible checked

    click ok
    menu will not appear

    goto code window...select you listbox...select mousedown

    Code:
    if buttone = 2 then me.popupmenu mnuPop
    then just code the delete menu choice...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5
    Guest
    For right click, take a look at these links, that Jop found:

    http://www.mvps.org/vbnet/code/lista...eclick-two.htm
    http://www.mvps.org/vbnet/code/lista...mouseclick.htm
    http://www.mvps.org/vbnet/code/lista...lick-three.htm


    geoff_xrx, spelled button wrong
    If button = 2....
    And you don't need Me.
    PopupMenu by itself can be used.
    PopupMenu MyMenu

    But really, for the right click and then popupmenu, you should take a look at the links above.

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Talking ooops

    buttone is the italian button.
    thanks matthew...didnt know about not using me. cool

    P.S....How do you get the smiles in the post?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    I can't thank enough you guys

    Best regards to you all,

    W.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  8. #8
    Guest
    Click the <-smilie to get a list of other smilies.

  9. #9
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715

    Re: ooops

    Originally posted by geoff_xrx
    How do you get the smiles in the post?
    Look here.
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  10. #10
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Matthrew, I didn't see your post...
    Oetje
    [email protected]
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

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