HI, I am new to webBrowser tool in C#.

If i use this code to navigate, and get the page source.

Webbrowser1.Navigate("http://www.google.com");
HtmlElement he = Webbrowser1.Document.Body;
string pagesource = he.InnerHtml;

But i am not getting the webbrowser fully loaded and i am not getting the full pagecontent.

Help me?

you need to wait before the browser is completely navigated..

use something like this

WebBrowser wb = new WebBrowser();
                HtmlDocument doc = null ;
                wb.Navigate("WWW.GOOGLE.COM");
                do
                {
                    Application.DoEvents();
                } while (wb.ReadyState != WebBrowserReadyState.Complete);

'Here do your coding

you need to wait before the browser is completely navigated..

use something like this

WebBrowser wb = new WebBrowser();
                HtmlDocument doc = null ;
                wb.Navigate("WWW.GOOGLE.COM");
                do
                {
                    Application.DoEvents();
                } while (wb.ReadyState != WebBrowserReadyState.Complete);

'Here do your coding

I tried this but it didn't help me..

may i know why i have been down voted ??

it sure worked for me..

here is the form load coding

private void Form1_Load(object sender, EventArgs e)
        {
            WebBrowser wb = new WebBrowser();
            wb.Navigate("www.google.com");
            do
            {
                Application.DoEvents();
            } while (wb.ReadyState != WebBrowserReadyState.Complete);

            string str = wb.Document.Body.InnerHtml;
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.