Friday, February 19, 2010

Copy a ListBox Items to Another ListBox

private void CopyAListItemToAnotherListItem()
{
ArrayList al = new ArrayList();
for (int i = 97; i < 105; i++)
{
al.Add(Convert.ToChar(i));
}

ListBox1.DataSource = al;
ListBox1.DataBind();

ListBox2.Items.AddRange(ListBox1.Items.Cast().ToArray());
}

No comments: