日期:2014-05-20  浏览次数:20999 次

winform问题,怎样把多行输入的textbox的每一行,作为一个list的item添加进去?
谢谢
我是这样想的
1,怎样判断textbox里共有多少行?

2,怎样取到每一行的值,并添加到listbox

------解决方案--------------------
up
------解决方案--------------------
textBox.Lines 这个数组里面有你要的东西
------解决方案--------------------
1.textBox1.Lines.Length

2.for(int i=0;i <textBox1.Lines.Length;i++)
{
listBox.Items.Add(textBox1.Lines[i]);
}
------解决方案--------------------
1,怎样判断textbox里共有多少行?
textBox1.Lines.Length
2,怎样取到每一行的值,并添加到listbox
string[] tempArray = new string [textBox1.Lines.Length];
tempArray = textBox1.Lines;
for(int counter=0; counter < tempArray.Length;counter++)
{
list.Items.Add(tempArray[counter]);
}