1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

NullReferenceException Was Unhandled c#

Discussion in 'Meet and Greet' started by tookerello, May 5, 2010.

  1. tookerello

    tookerello New Member

    Joined:
    May 5, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    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 bold line

    public static Conditions GetCurrentConditions(string location)
    {
    Conditions c;
    c = null;
    c = new Conditions();

    c.GetCurrentConditions();

    XmlDocument xmlConditions = new XmlDocument();
    xmlConditions.Load"""));
    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;
    }

    return c;
    }
     

Share This Page