我使用了2个列表框控件
例如:
list box 1 list box 2
hi
bye
how
然后传递第二个列表框中的值
例如:
list box 1 list box 2
how hi
bye
我有用于保存第二个列表框项目的文本文件(记事本)的代码。
答案 0 :(得分:1)
循环通过ListBox,然后将其写入您的txt文件。
string sListBoxItems = "";
for(int i = 0; i < listBox1.Items.Count; i++) {
sListBoxItems += listBox1.Items[i].ToString();
}
File.WriteAllText("yourfile.txt", sListBoxItems );