Results 1 to 6 of 6

Thread: Deleting items in list box

  1. #1

    Thread Starter
    Lively Member VB Begginer Kid's Avatar
    Join Date
    Jul 2001
    Location
    home
    Posts
    127

    Deleting items in list box

    this should be easy. how can i delete items in a listbox?
    I'm a beginner.
    ------------------------------------------------
    Your impossible ego ***** is like a
    Megalomaniacal tab on my tongue
    You *****in' touch me I will rip you apart


  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. List1.RemoveItem 0

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    where 0 is the index of the item you are removing
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Cool Hello:)

    Try this
    VB Code:
    1. Private Sub Form_Click()
    2. While list1.ListCount > 0
    3. list1.RemoveItem list1.ListCount - 1
    4. Wend
    5. End Sub
    6.  
    7. Private Sub Form_Load()
    8. list1.AddItem "Play"
    9. list1.AddItem "Boy"
    10. End Sub
    Last edited by prog_tom; Aug 13th, 2001 at 07:07 PM.

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Hello:)

    Originally posted by prog_tom
    Try this
    VB Code:
    1. Dim i as Long
    2. For i = 0 to List1.ListCount
    3. List1.RemoveItem i
    4. Next i
    unfortunately, this example will result in an error. You'll have to go backwards through the list

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810

    Talking Problem fixed...

    Well I fixed the problem...

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

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