Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What I am doing wrong? Im sure is a silly mistake. But in this moment I don't see it.
C#
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.
Posted
Updated 19-Nov-11 1:06am
v2
Comments
Аslam Iqbal 19-Nov-11 7:16am    
What is your .NET version? In .NET4 and C# this feature is not available.

Perhaps, if you gave it time to finish the loading, it might help...

Try handling the DocumentCompleted event, and loading the textbox content there.
 
Share this answer
 
Comments
_Q12_ 19-Nov-11 7:17am    
thanks, ok.
textBox1.Text = webBrowser1.Document.GetElementsByTagName("Body")[0].InnerText
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900