Try this way may be it works
namespace Addedfunction
{
if (Strt_Address != null)
{
sLong1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lat", XmlMngr1).InnerText;
sLat1 = geocodeXmlDoc1.DocumentElement.SelectSingleNode(@"//geometry/location/lng", XmlMngr1).InnerText;
sLong2 = geocodeXmlDoc2.DocumentElement.SelectSingleNode(@"//geometry/location/lat", XmlMngr2).InnerText;
sLat2 = geocodeXmlDoc2.DocumentElement.SelectSingleNode(@"//geometry/location/lng", XmlMngr2).InnerText;
Label1.Text = sLong1 + ", " + sLat1;
Label2.Text = sLong2 + ", " + sLat2;
elong1 = Convert.ToDouble(sLong1);
elat1 = Convert.ToDouble(sLat1);
elong2 = Convert.ToDouble(sLong2);
elat2 = Convert.ToDouble(sLat2);
}
else {
Label1.Text = "Input Valid values";
}
double distLong = elong1 * (Math.PI / 180.0);
double distlat = elat1 * (Math.PI / 180.0);
double distLong1 = elong2 * (Math.PI / 180.0);
double distlat1 = elat2 * (Math.PI / 180.0);
}
Other wise elong,elat1,elong2,elat2 need to be declare globally..