返回首页

您好,
我米用VS2008的后端SQL服务器2008。我正在制作一个Windows应用程序中,我有2 listboxes.the数据被检索从SQL数据库服务器listbox1.i要选择几个ITMS从这个列表框,并将它们添加到第二个通过添加按钮。问题:值正在retireved从数据库中,但是当我点击添加按钮后,选择从ListBox1的价值,System.Data.DataRowView ListBox2的自动显示。 ListBox2的目前没有连接到任何数据库对。这里是代码

为(int i = 0;我LT; listBox1.Items.Count;我)
{listBox2.Items.Add(listBox1.Items [I])
listBox1.Items.Remove(listBox1.SelectedItem);
}

我也曾尝试使用这样的:

为(int i = 0;我LT; from.SelectedItems.Count;我)
{to.Items.Add(from.SelectedItems [我]的ToString());}
的foreach(VAR项目在新的ArrayList(from.SelectedItems))
{from.Items.Remove(项目);}

并分别listBox1和ListBox2的

任何帮助将不胜感激

回答

评论会员: 时间:2