-1
我用了2个列表框控件
例如:如何在asp.net [服务器端]的文本文件中保存列表框项?
list box 1 list box 2
hi
bye
how
然后传递值在第二个列表框中
例如:
list box 1 list box 2
how hi
bye
我有代码,节省了第二个列表框中的项目INT文本文件(记事本)。
我用了2个列表框控件
例如:如何在asp.net [服务器端]的文本文件中保存列表框项?
list box 1 list box 2
hi
bye
how
然后传递值在第二个列表框中
例如:
list box 1 list box 2
how hi
bye
我有代码,节省了第二个列表框中的项目INT文本文件(记事本)。
循环遍历列表框,然后将其写入您的txt文件。
string sListBoxItems = "";
for(int i = 0; i < listBox1.Items.Count; i++) {
sListBoxItems += listBox1.Items[i].ToString();
}
File.WriteAllText("yourfile.txt", sListBoxItems);
列表框数为“0”,循环不运行 –
你的意思“计数为0”?如果你可以用细节解释你的问题,我可以帮助你。 – Badiparmagi
我将第一个列表框中的值传递给第二个列表框。然后保存第二个列表框但空的 –