Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Get the error: "Object reference not set to an instance of an object"

Hi

I have this code:
        private void bbGetHtml_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            HtmlAgilityPack.HtmlDocument page = new HtmlWeb().Load("https://www.xxx.nl/search/process_result.phtml?mypref_search_id=0");
            var pageLinks = page.DocumentNode.SelectNodes("//class[@class='mtcMemberNotGreylisted']//a");
            foreach (var link in pageLinks)
            {
                txtResult.Text = link.Attributes["title"].Value;
            }
        }

Open in new window


But i get the error at the Foreach-line: "Object reference not set to an instance of an object"
What does this mean and who can help me?

Greetings, Peter Kiers
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Thanks