How can I reference a single marker from many.

May 19, 2010 at 8:29 PM
Edited May 20, 2010 at 1:15 PM

I have a number of markers on a map. When I click on one I can change the marker colour and store it's Lat/Long position.  If I then click another marker how can I find which was the previous selection so that I can change it back to the normal colour before changing the colour of the new selection?

This is how I create the markers and route:
Private Sub PlotRoute()
        Dim OverlayRoutes = New GMapOverlay(MyMap, "Layer-Route")
        Dim MyRoute As New List(Of GMap.NET.PointLatLng)
        Dim MyMarkers = New GMapOverlay(MyMap, "Layer-Stops")
        Dim MyPoint As New PointLatLng
        Dim TempData As Record
        Dim x As Integer = 0
        ' Step through all the gps data reading the Lat and Long into the Markers and Route.
        For Each TempData In GpsData
            MyPoint = New PointLatLng(TempData.Latitude, TempData.Longditude)
            Dim M As New GMapMarker_RedDot(MyPoint)
        ' Show the Markers overlay.
        ' Create and show the Route Track.
        Dim Track As MapRoute = New GMapRoute(MyRoute, "track")
    End Sub
BTW this is such a fantastic bit of programming.


P.S. Sorry, I can't find a way to stop the code all going into one block! Don’t use Firefox for discussions, then everthing works!


May 19, 2010 at 8:37 PM

hey, just store your selected marker, and restore it before assigning new one

May 20, 2010 at 11:39 AM
Edited May 20, 2010 at 11:51 AM
Thanks, but two things. 1. How do I get a code list to look right instead of the block that has appeared. It looked correct in the editor! 2. I can't see how to delete a particular marker. Thanks, Dennis.
May 20, 2010 at 12:05 PM

when you paste code, use 'Insert code Snippet', and how to delete marker, check MainForm_KeyUp in Demo.WindowsForms

May 20, 2010 at 1:09 PM
Edited May 20, 2010 at 1:16 PM


I rarely use Internet Explorer and all this rich formating doesn't show in Firefox.  Another exeption to add!