View Full Version : listbox prob!
tadpole
12-15-03, 01:45 PM
Hello,
I'm having a problem with my list boxes, I have two listboxes. I have selected multiple selections on both listboxes but I can't seem to work out how to move multiple selected items between the boxes. . . i think a for loop is needed, but I'm getting myself into a muddle, can anyone help me?
Cheers
Taddy
Hello,
I'm having a problem with my list boxes, I have two listboxes. I have selected multiple selections on both listboxes but I can't seem to work out how to move multiple selected items between the boxes. . . i think a for loop is needed, but I'm getting myself into a muddle, can anyone help me?
Cheers
Taddy
Post what you have so far.
newcoder
02-17-04, 07:51 AM
Hello,
I'm having a problem with my list boxes, I have two listboxes. I have selected multiple selections on both listboxes but I can't seem to work out how to move multiple selected items between the boxes. . . i think a for loop is needed, but I'm getting myself into a muddle, can anyone help me?
Cheers
Taddy
Hai friend,
The below code will work in C#. Pls let me help you if you have any difficulty still.
private void Button1_Click(object sender, System.EventArgs e)
{
for (int i=0;i < ListBox1.Items.Count;i++)
{
if (ListBox1.Items[i].Selected)
{
ListBox2.Items.Add(ListBox1.Items[i].Text);
}
}
}
vBulletin® v3.6.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.