Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



How to remove items from ListBox

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-08-2009
Member
 
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?
Reply With Quote
  #2  
Old 29-08-2009
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,937
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.
Reply With Quote
  #3  
Old 29-08-2009
Member
 
Join Date: Nov 2008
Posts: 1,193
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)
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to remove items from ListBox"
Thread Thread Starter Forum Replies Last Post
MSE: How to Remove Quarantined Items Adrut Technology & Internet 5 07-08-2010 03:17 PM
Add/remove programs listbox.htc not registered Justin23 Operating Systems 3 08-12-2009 03:47 PM
Remove start up items Arval Operating Systems 4 10-03-2009 07:19 PM
Delete orphaned items from Add/Remove Programs? Demetrius Operating Systems 4 06-03-2009 02:54 PM
How to remove Desktop context menu items Sudy Nim TroubleShoot 98 6 30-01-2008 10:33 PM


All times are GMT +5.5. The time now is 07:39 AM.