Click here to Skip to main content
15,925,133 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make an application that will pull baseball scores from the internet and show them to me. I have the HtmlAgilityPack installed. I have tried using the following code that I got from Stack Overflow:


string Url = "http://bit.ly/1EKhMg0";

HtmlWeb web = new HtmlWeb();
HtmlDocument doc = web.Load(Url);

string scoreOne = doc.DocumentNode.SelectNodes("//*[@id=\"uid_0\"]/div[1]/div/div[3]/div/div[4]/div[2]/div/div[2]")[0].InnerText;



However, the code throws a Null Reference exception. What am I doing wrong?
Posted
Comments
Richard MacCutchan 2-May-15 5:17am    
Use your debugger to dind out what is returned by the web.Load call. What do you get when you type that URL into your browser?
Member 11581301 2-May-15 11:09am    
I'm pretty sure I did it right, but I found something called ResponseUri and it had the link I wanted in it. I went to that on Google and it brought me straight there. I'm sorry, I'm really nooby at this.

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