Reference markers after adding

Jan 7, 2010 at 8:29 PM

Hello,

I have successfully added a group of markers in a test application I am creating.  I was able to do that using the following code:

For Each row As DataRow In _MapData.Rows
                lat = row.Item("LocLatitude")
                lon = row.Item("LocLongitude")
                LocID = row.Item("LocID")
                point = New PointLatLng(lat, lon)
                m = New GMapMarkerGoogleGreen(point)
                cm = New MyCustomMarker(point)
                mborders = New GMapMarkerRect(point)

                p = GMaps.Instance.GetPlacemarkFromGeocoder(point)
                'objects.TooltipFont = New Font("Arial", 5, FontStyle.Bold)
                If p.Address.Contains("Vandergrift") Then
                    cm.MarkerImage = New Bitmap("C:\Users\Jacob\Downloads\Pushpin Images\197MaroonExplosionSign.bmp")
                    cm.ToolTipText = p.Address
                    cm.TooltipMode = MarkerTooltipMode.OnMouseOver
                    cm.Size = New System.Drawing.Size(10, 10)
                    objects.Markers.Add(cm)
                Else
                    m.ToolTipText = p.Address
                    m.Tag = LocID                    
                    m.Size = New System.Drawing.Size(10, 10)
                    objects.Markers.Add(m)
                End If

                objects.Markers.Add(mborders)

Next row

 

I added these markers based on entries in a database and therefore will never know the exact number of markers that will be displayed.  After displaying them I was hoping to access a marker's properties by using the click_event and displaying its information.  However, I have had trouble doing this.  I thought that I could use the declared overlay and access the complete list of markers, but I haven't been able to do that.  For example, something like the following: objects.Markers.CurrentMarker.Tag.  Any help would be much appreciated!  Thanks!

Coordinator
Jan 7, 2010 at 8:35 PM

yes each marker has Tag property, you can use it, or just custom yourClass : GMapMarker. I recommend create class for db table, and after reading data from db save it to list for further needs.

Jan 7, 2010 at 8:44 PM

Ok, thanks. Just for clarity...When you say list, do you mean something like a stack or an array?  Is there no collection to access?

 

Coordinator
Jan 8, 2010 at 4:38 AM

when i said list, i mean it, the list ;}