问题描述
我的代码如下
i希望我从列表框中选择一些项目,所选项目会自动添加到另一个列表框并从第一个列表框中删除。
使用c#在asp.net上
。
我尝试过:
protected void ListBox3_SelectedIndexChanged(object sender,EventArgs e)
{
}
protected void ListBox4_SelectedIndexChanged(object sender,EventArgs e)
{
}
protected void Button6_Click(object sender, EventArgs e)
{
int i;
for(i = 0; i< = ListBox3.Items.Count; i ++)
{
ListBox4.Items .Add(ListBox3.SelectedItem);
ListBox3.Items.Remove(ListBox3.SelectedItem);
}
}
}
}
my code is as follows
i want that i select some items from the list box and the selected items are automatically add on to another list box and remove from the first list box .
in asp.net using c#.
What I have tried:
protected void ListBox3_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void ListBox4_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void Button6_Click(object sender, EventArgs e)
{
int i;
for (i = 0; i <= ListBox3.Items.Count; i++)
{
if (ListBox3.Items[i].Selected == true)
{
ListBox4.Items.Add(ListBox3.SelectedItem);
ListBox3.Items.Remove(ListBox3.SelectedItem);
}
}
}
}
这篇关于如何解决“指数超出范围。必须是非负数且小于集合的大小。在ASP .NET中使用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!