المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Automatic webbrowsing gives "object reference not set to an instance of an object"



C# Programming
05-21-2009, 10:41 PM
Hello.

I have a application, that does automative navigating of a webbrowser object..
I just often get the error:
"object reference not set to an instance of an object"
when the application is trying to get the html source or the lenght of a site, with this code:
if (webBrowser1.Document.********Frames[2].Document.Body.InnerHtml.Length < 5)
{
return true;
}

Even though I have functions that waits for the site to load done before continue it often occurs if the internet are a bit slow..

Is there anyway I can check if the object reference is set, or another way to solve this?

Hope there is help to find http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif