plzz help , I'm stuck, markers

Topics: Windows Forms
Oct 31, 2011 at 2:12 PM
Edited Oct 31, 2011 at 3:42 PM

well , i posted this question several times but no answer so far

im working on VB.NET , and im trying to do something like this :

 

Dim marker() As GMapMarkerCross

for i = 1 to car.count()

if (car.id <> code) then

marker(i).Position = New PointLatLng(Lat, Lon)

overlayOne.Markers.Add(marker(i))

else

marker(i).position = New PointLatLng(Lat, Lon)

end if


its doesn't work , whats the problem ??

 

Nov 1, 2011 at 8:28 AM
Edited Nov 1, 2011 at 9:23 AM

I'm no VB-expert, but are you initalizing the GMapMarkers? E.g. (pseudocode):

for(i=0; i < arrayOfMarkers.Length; i++)

   arrayOfMarkers(i) = new GmapMarkerCircle(...)

endfor

What is not working? Are you getting an Exception?

Nov 1, 2011 at 11:43 AM
Edited Nov 1, 2011 at 11:46 AM

didn't give me any markers in the map ,

you can write your code with c# guys , i can translate it to Vb.net

i use the code u gave me , but still nothing :

 

Dim marker() As GMapMarkerCross
for i = 1 to car.count()
if (car.id <> code) then
marker(i) = New GMapMarkerCross(GMapControl1.Position)
marker(i).Position = New PointLatLng(Lat, Lon)
overlayOne.Markers.Add(marker(i))
else

marker(i).position = New PointLatLng(Lat, Lon)
end if

guys i really need yur help

Nov 1, 2011 at 12:58 PM

This works perfectly in C# (code is in the constructor, define a class variable for the array and the overlay):

 

        private GMapMarkerCross[] arrayOfMarkers = new GMapMarkerCross[10];

        private GMapOverlay overlay;

        public TestForm()
        {
            InitializeComponent();

            overlay = new GMapOverlay(map, "test");
            map.Overlays.Add(overlay);

            for (int i = 0; i < 10; i++)
            {
                GMapMarkerCross marker = new GMapMarkerCross(new PointLatLng(10 + i, 30 - i));
                overlay.Markers.Add(marker);
                arrayOfMarkers[i] = marker;
            }
        }

Nov 1, 2011 at 1:16 PM

thank you so much my xandolph , it works :) :)

problem solved