本文介绍了textBox1.Text = webBrowser1.Document.Body.InnerText ---无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做错了什么?我确定是一个愚蠢的错误。但是在这一刻我没有看到它。

  private   void  Form1_Load( object  sender,EventArgs e)
{
webBrowser1.ScriptErrorsSuppressed = ;
webBrowser1.Navigate( @ D:\ Programme\Info\Visual Studio 2010 \Projects \RussianAlfabet\RussianAlfabet\bin\Debug\acceptable.word);

尝试
{
textBox1.Text = webBrowser1.Document.Body.InnerText; // ---不工作
}
catch (Exception ex)
{
MessageBox.Show(ex.Message); // 对象引用未设置为对象的实例。
}
// 我的webBrowser1显示页面正确,但textbox1没有显示任何因为这个错误。

}



谢谢。

解决方案


What I am doing wrong? Im sure is a silly mistake. But in this moment I don't see it.

private void Form1_Load(object sender, EventArgs e)
{
    webBrowser1.ScriptErrorsSuppressed = true;
    webBrowser1.Navigate(@"D:\Programe\Info\Visual Studio 2010\Projects\RussianAlfabet\RussianAlfabet\bin\Debug\acceptable.word");
    
    try
    {
        textBox1.Text = webBrowser1.Document.Body.InnerText; // ---not working
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);   //Object reference not set to an instance of an object.
    }
//My webBrowser1 display the page all right, but the textbox1 is not displaying anything because of this error.

}


thanks.

解决方案



这篇关于textBox1.Text = webBrowser1.Document.Body.InnerText ---无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 10:18