TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
davy smith
NA
7
0
NullReferenceException was unhandled
May 5 2010 12:21 PM
Hi could somebody please help me with this as i have been trying to fix it for hours!!!
I keep receving the "NullReferenceException was unhandled " message in the line in bold
public static Conditions GetCurrentConditions(string location)
{
Conditions c;
c = null;
c = new Conditions();
c.GetCurrentConditions();
XmlDocument xmlConditions = new XmlDocument();
xmlConditions.Load(string.Format("http://www.google.com/ig/api?weather={0}", location));
if (xmlConditions.SelectSingleNode("xml_api_reply/weather/problem_cause") != null)
{
c = null;
}
else
{
Conditions cond = new Conditions();
cond.Town = xmlConditions.SelectSingleNode("/xml_api_reply/weather/forecast_information/city").Attributes["data"].InnerText;
cond.Condition = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/condition").Attributes["data"].InnerText;
cond.TempC = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_c").Attributes["data"].InnerText;
cond.TempF = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/temp_f").Attributes["data"].InnerText;
cond.Humidity = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/humidity").Attributes["data"].InnerText;
cond.Wind = xmlConditions.SelectSingleNode("/xml_api_reply/weather/current_conditions/wind_condition").Attributes["data"].InnerText;
}
return c;
}
Reply
Answers (
1
)
Asp.Net MVC Framework
Threading not concurrent? What have I missed?