Results 1 to 7 of 7

Thread: Basic ListBox Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Hiyas,

    I'm not exactly a VB expert, so please help me out here. =)

    How do I remove a selected item in a ListBox? I tried using .RemoveItem, but it needs an index value, and now I'm stuck.

    Thanks,

    -Git

  2. #2
    Lively Member
    Join Date
    May 1999
    Location
    Singapore
    Posts
    116
    the inde value is the number f the item u wanna delete
    YC Sim
    Teenage Programmer
    UIN 37903254



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    How do I get the value though?

    Thanks,

    -Git

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

    Well ....

    Very Basic......


    Here is the answer, kiddo.

    When you display a list box full of some values, its .ListIndex property is -1. When a user clicks on any item in the list, the .ListIndex property contains the index of that item. So you have to write..

    List1.RemoveItem(List1.ListIndex)

    Does it help?

    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!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Thanks mate - works perfectly. =]

    -Git

  6. #6
    New Member
    Join Date
    May 2000
    Posts
    13
    The Index start from 0 at the top of the ListBox.
    Am I right?
    Very glad to see you !
    I'm a very begginer!

  7. #7
    Lively Member
    Join Date
    May 1999
    Location
    Singapore
    Posts
    116
    yeah, the first item is 0
    second item is 1 and so on...
    YC Sim
    Teenage Programmer
    UIN 37903254



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