Monday, March 8, 2010

Copy All items from One Listbox to another Listbox



Hi,

I tried to copy all the entries from one listbox to another.

I do not want to loop through the listbox to move each one at a time.

Is there any way?

Yes. The ways is

ListItem[] items = new ListItem[ListBox1.Items.Count];
ListBox1.Items.CopyTo(items, 0);
ListBox2.Items.AddRange(items);
ListBox1.Items.Clear();


Download File Here

No comments: