Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 list boxes

Status
Not open for further replies.

BobBob10

Programmer
Apr 24, 2005
57
GB
Hi,

I am wanting some help with list boxes. I have a web form with two list boxes (1 for available list and the second for selected list).

What I want is some code which will be able to transfer one item from the first list box and transfer this to the other.

Any ideas?

Bob
 
With 2 listboxes, adding to listbox2 from listbox1:
(Set AutoPostBack = TRUE on listbox1)
Code:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
   Dim li As New ListItem
   li = ListBox1.SelectedItem
   li.Selected = False
   ListBox2.Items.Add(li)
End Sub

Jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top