0
try this
foreach (ListItem val in ListBox1.Items.Cast<ListItem>().Where(val => val.Selected))
{
ListBox2.Items.Add(val);
}
0
try like this:
if (ListBox1.Items.Count > 0)
{
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected)
{
string selectedItem = ListBox1.Items[i].Text;
//insert command
ListBox2.Items.Add(selectedItem);
}
}
}