Community of VE/MapPoint Users and Developers
This is a discussion on MapPoint OCX control does not work on a .Net MDI form. within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have a .NET mdi application and I am trying to use the MapPoint control on one of the MDI ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MapPoint OCX control does not work on a .Net MDI form. An unhandled exception of type 'System.ArgumentException' occurred in axinterop.mappoint.dll Additional information: MapPoint failed to load. The cause of this failure is unknown. The very same code that I am using works on a non-MDI form. axMappointControl1.OpenMap("c:\\test.ptm"); Any ideas on how I can get this to work? Jeff |
| ||||
|
I have not tried this yet but are you sure you need 2 backslashs in the path to the filename? Can you open a new map: axMappointControl1..NewMap(geoMapNorthAmerica) or axMappointControl1..NewMap(1)
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| RE:MapPoint OCX control does not work on a .Net MDI form.
Thanks for the reply... :) Sorry, I forgot to mention that the particular code example is C# and that the code is being executed from the form's Load event. The double slash is needed because in C# the backslash is an escape character, ie \t for tab etc... but I'm sure you already knew that and were just covering all the bases. In any case, I found that for some reason when using a form as an MDI child you cannot use the MapPoint control to open or create a map in the form's Load event. However, if you perform the MapPoint control's map open or create on the Enter event of the MapPoint control itself (which can be called as soon as the form finishes loading) or some other event after the form is loaded, the control works. Go figure. On a non-MDI child form, (aka a regular .Net windows form) there is no problem using the form's Load event to open or create a map. This MDI issue occurs with both VB.NET and C#. So in short I got it working but I still wish I knew why... |
| ||||
|
Jeff, Well, at least you have it working. It is an intresting issue, I wonder if you compile the code and run it would that make a difference. Probably not but once in a while something like this will happen in debug mode but run fine compiled. (at least in VB6).
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| MapPoint OCX control in C#
Jeff, I've just starting :) working with MapPoint and you just saved me from a very stressful evening! Opening a map during the Control_Validated() event works for me. I believe the issue with using the Form_Load() event has something to do with the control not being completely instantiated prior to the call to OpenMap(). Using the Control_Validated() event guarantees you that the control has been created (initialized) successfully. Thanks again, Phil. |
![]() |
| Tags |
| control, form, mappoint, mdi, net, ocx, work |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| the map is empty after Show/Hide form with MapPoint control | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-25-2004 04:24 PM |
| Alignment of the control on my form | blackmap | MapPoint 2006/2009 Discussion | 2 | 09-25-2003 02:43 AM |
| How do I make a MapPoint COM+ AddIn form non modal? | Anonymous | MapPoint 2006/2009 Discussion | 0 | 08-26-2003 09:16 AM |
| MapPoint Control align in Form | blackmap | MapPoint 2006/2009 Discussion | 0 | 02-06-2003 11:26 AM |
| Is it possible to save a MapPoint file in a form r.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 03-09-2002 11:48 PM |