GMapControl Won't display more than once

Topics: Help, Windows Forms
Dec 1, 2012 at 8:11 PM

Whenever I have a form with a GMapControl it will display once but if I try opening a new instance of the form the GMapControl just loads a red "X" across the rectangle with a white background. All other functions besides clicking on markers that are loaded work (such as clicking to grab the lat/lng coordinate). Also, if I create another modal form from the form with the map and then come back to the parent form and try to do anything with the map (like clicking on it) it does the 'red-X' thing.

This is the piece of my code that loads the map:

 private void GMapView_Load(object sender, EventArgs e)
        {
            GMapView.SetCurrentPositionByKeywords("Stevens Point, WI");
            GMapView.MapProvider = GMapProviders.GoogleMap;
            GMapView.MinZoom = 3;
            GMapView.MaxZoom = 17;
            GMapView.Zoom = 14;
            GMapView.MarkersEnabled = true;
            GMapView.EmptyMapBackground = Color.Azure;
            GMapView.Manager.Mode = AccessMode.ServerAndCache;
            GMapOverlay overlayOne = new GMapOverlay("OverlayOne");
            GMapView.Overlays.Add(overlayOne);
            
            foreach (POI poi in tour.PoiList)
            {
                double lat = Convert.ToDouble(poi.Coordinate.Latitude);
                double lng = Convert.ToDouble(poi.Coordinate.Longitude);
                GMapView.Overlays[0].Markers.Add(new GMarkerGoogle(new PointLatLng(lat, lng), GMarkerGoogleType.white_small)); 
            }
        }

Dec 1, 2012 at 8:18 PM

does it make a difference if you put the code in form constructor?

Dec 1, 2012 at 8:26 PM

I'm afraid not. :\

Dec 1, 2012 at 8:30 PM

hm, what version do you use?

Dec 1, 2012 at 8:37 PM

.Net Framework 4

 

 I'm not sure what version of GMaps. I got it from http://greatmaps.codeplex.com/downloads/get/336069 which said it was the newest version?

Dec 1, 2012 at 9:07 PM

so after a little more experimentation I've come up with a little more detail of the problem.


If I set the child forms to be non-modal: as long as I do not close any of them, the parent form will create the child forms with the maps working (even if they're different locations).

As soon as I close any of the child forms and try to create/show a new child form from the parent form, that child form's map loads the 'red x of doom'. 

Dec 1, 2012 at 10:29 PM

Used the recomended download of "GMap.NET.WindowsForms.zip" from the following link instead and re-installed it into my program. Works fine now. :)

http://greatmaps.codeplex.com/releases/view/20235

Dec 1, 2012 at 11:33 PM
Edited Dec 1, 2012 at 11:34 PM

newest is http://greatmaps.codeplex.com/downloads/get/557245

Sep 13, 2013 at 2:08 AM
If i use the newest i will get the same problem as axeljlarsen mentioned.

Is this a bug in newest? Is there a way to solve it?