获取第一行内容代码是这样的:
            webBrowser1.Document.GetElementById("username").InnerText = textBox1.Text;
            webBrowser1.Document.GetElementById("password").InnerText = textBox2.Text;
下一行代码写不出来

解决方案 »

  1.   

    你去看一下  winform与html  通过webBrowser的交互,然后就明白怎么做了
      

  2.   

    你不如试试文本读取,把所有内容放在一个txt里面,然后用流读取的时候可以一行一行读取,或者把文本直接转成流,然后在一行一行读取
      

  3.   

    http://msdn.microsoft.com/zh-cn/library/system.io.textreader.aspx可以把文字转成流之后,把每行的文本放在 一个List<string> 集合里面 ,然后自己去计算读取的下标 就好了
      

  4.   

    HtmlElement he = IE.Document.GetElementById("username");
                    he.SetAttribute("value", textBox1.text);
      

  5.   


    哥们 你这是把textbox1多行的内容全部获取 
      

  6.   


    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
      

  7.   


    哥们 你这是把textbox1多行的内容全部获取 
    你要获取一行啊?把\r\n分割出来就好啦
      

  8.   

    TextBox1.Text.Split(new char[]{'\n'})[0]。这样写懂不?根据下标取就行了。
      

  9.   


    获取第一行内容代码是这样的:
                webBrowser1.Document.GetElementById("username").InnerText = textBox1.Text;
                webBrowser1.Document.GetElementById("password").InnerText = textBox2.Text;
    下一行代码写不出来

    把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];
      

  10.   

    定义一个全局int IndexNum=0;在buttonclick事件里
     webBrowser1.Document.GetElementById("username").InnerText = textBox1.Lines[IndexNum];
                webBrowser1.Document.GetElementById("password").InnerText = textBox2.Lines[IndexNum];
    ...
    IndexNum++;
      

  11.   

    webBrowser1.Document.GetElementById("username").InnerText = textBox1.Text;
                webBrowser1.Document.GetElementById("password").InnerText = textBox2.Text;
    定义一个全局int IndexNum=0;  在buttonclick事件里    
     webBrowser1.Document.GetElementById("username").InnerText = textBox1.Lines[IndexNum];
                webBrowser1.Document.GetElementById("password").InnerText = textBox2.Lines[IndexNum];