Results 1 to 3 of 3

Thread: How to remove items from ListBox

  1. #1
    Join Date
    Jul 2009
    Posts
    124

    How to remove items from ListBox

    I am having two list boxes namely emp1 and emp2. The first one is filled with 10000 entries whereas the other is empty. I want to move some of the entries from emp1 to emp2 for the employees which has left the company. To do so I have to remove the items from emp1 and then add them to emp2. Logic is proper but the problem is that I am unable to do. Can you help me how to code for removing an item from emp1 and then add them to emp2? How to remove items from ListBox?

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to remove items from ListBox

    The code should be something like this:

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e _
    As System.EventArgs) Handles Button1.Click
    ListBox1.Items.RemoveAt(6)
    'remove the item by specifying it's index number in the above code
    End Sub
    In short use Items.Remove or Items.RemoveAt() to remove the item from the listbox.

  3. #3
    Join Date
    Nov 2008
    Posts
    1,192

    Re: How to remove items from ListBox

    You can remove the item from emp1 by using the code:

    Code:
    emp1.RemoveItem (emp1.SelectedItem)
    and then add the same item by using the code:

    Code:
    emp2.AddItem (emp1.SelectedItem)

Similar Threads

  1. MSE: How to Remove Quarantined Items
    By Adrut in forum Technology & Internet
    Replies: 5
    Last Post: 07-08-2010, 02:17 PM
  2. Add/remove programs listbox.htc not registered
    By Justin23 in forum Operating Systems
    Replies: 3
    Last Post: 08-12-2009, 03:47 PM
  3. Remove start up items
    By Arval in forum Operating Systems
    Replies: 4
    Last Post: 10-03-2009, 06:19 PM
  4. Delete orphaned items from Add/Remove Programs?
    By Demetrius in forum Operating Systems
    Replies: 4
    Last Post: 06-03-2009, 02:54 PM
  5. Media Center Library - How to remove items
    By Rhys in forum Windows Software
    Replies: 3
    Last Post: 18-02-2009, 11:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,210,671.70449 seconds with 16 queries