this is the coding:

string latitude1, latitude2;

string longitude1, longitude2;

latitude1 = label7.Text;

longitude1 = label8.Text;

label7.Text = gps.RMC.Latitude.ToString();

label8.Text = gps.RMC.Longitude.ToString();

templat = gps.RMC.Latitude.ToString();

templong = gps.RMC.Longitude.ToString();

latitude2 = label7.Text;

longitude2 = label8.Text;

if ((latitude1 != latitude2) || (longitude1 != longitude2))

{

double lat1 = Convert.ToDouble(latitude1);

double long1 = Convert.ToDouble(longitude1);

double lat2 = Convert.ToDouble(latitude2);

double long2 = Convert.ToDouble(longitude2);

double lat1r = lat1 * (Math.PI / 180);

double long1r = long1 * (Math.PI / 180);

double lat2r = lat2 * (Math.PI / 180);

double long2r = long2 * (Math.PI / 180);

double latitude = lat2r - lat1r;

double longitude = long2r - long1r;

double a = Math.Pow(Math.Sin(latitude / 2.0), 2.0) + Math.Cos(lat1r) * Math.Cos(lat2r) * Math.Pow(Math.Sin(longitude / 2.0), 2.0);

double c = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1.0 - a));

const Double earthRadius = 6376.5;

distance = earthRadius * c;

}

distanceCovered = distanceCovered + distance;

lblDC.Text += distanceCovered.ToString();

any idea of how i can solve this problem