Sub Process_Globals
....
Type POI (lat As Double, lon As Double, tour As Int, visited As Int) 'this is the Type which holds the point information (POI=Point of interest)
Dim POImap As Map 'this is a Map/Dictionary which holds the various points of my tour
....
end sub
Sub OnMyLocationChangeListener1_MyLocationChange(location1 As Location)
'when the location changed we loop trough the map and calculationg the distance of each Point of Interest. The labels are also in a map with the same key as the POI
For j = 0 To POImap.Size-1
Dim dLabel As Label
Dim p As POI 'type declared in process_globals
Dim loc As Location
Dim d As Double
p = POImap.GetValueAt(j)
'Each POI as a corresponding label in a scrollview showing it's distance to my position....
dLabel = LabelMap1.Get(p.id)
loc.Initialize2(p.lat,p.lon)
d = loc.DistanceTo(location1)
p.dist = d
POImap.Put(p.id,p)
'now we are changing the distance information for each poi (label in a scrollview)
If d < 1000 Then
dLabel.Text = "Entfernung: " & NumberFormat(d,0,0) & " m"
Else
dLabel.Text = "Entfernung: " & NumberFormat((d/1000),0,2) & " km"
End If
dLabel.Invalidate
Next
End Sub