'We initialize first the 2 Location. The first Location is our location and the second location is the target location.
Dim l1, l2 As Location
l1.Initialize2(MyCurrentLatitude, MyCurrentLongitude)
l2.Initialize2(TargetCoordinateLatitude), TargetCoordinateLongitude)
'now we need the distance between our location and the target location
Dim distance As Long
distance = l1.DistanceTo(l2) 'the result is in meter
'because the distance is in meter we must specify it in thousandths, like miliseconds in seconds
If distance < 1000 Then
lbl_distance.Text = "very close!"
Else If distance > 1000 Then
lbl_distance.Text = "near!"
Else If distance > 5000 Then
lbl_distance.Text = "far!"
Else If distance > 10000 Then
'if the target more than 10 kilometers away, then we want to show it in kilometers, because we have the value in meters, we are convert it to kilometer.
lbl_distance.Text = Round(distance/1000) & "KM"
End If