111,120
社区成员
发帖
与我相关
我的任务
分享
[/quote]
把textBox1和textBox2的Multiline属性改为true。
获取第一行内容代码是这样的:
webBrowser1.Document.GetElementById("username").InnerText = textBox1.Lines[0];
webBrowser1.Document.GetElementById("password").InnerText = textBox2.Lines[0];
获取第二行内容代码是这样的:
webBrowser1.Document.GetElementById("username").InnerText = textBox1.Lines[1];
webBrowser1.Document.GetElementById("password").InnerText = textBox2.Lines[1];
[/quote]
你要获取一行啊?把\r\n分割出来就好啦
StringBuilder stringToRead = new StringBuilder();
stringToRead.AppendLine("Characters in 1st line to read");
stringToRead.AppendLine("and 2nd line");
stringToRead.AppendLine("and the end");
List<string> strList=new List<string>();
using (StringReader reader = new StringReader(stringToRead.ToString()))
{
while(reader.peek>-1){
strList.add(reader.ReadLine);
}
}
这样把没行都放在了strList里面 你要读取第一行就是strList[0] 第二行就是strList[1]...
具体请参考MSDN 详细资料
http://msdn.microsoft.com/zh-cn/library/system.io.stringreader.aspx
