MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint OCX control does not work on a .Net MDI form.

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-22-2002
Junior Member
White Belt
 
Join Date: Oct 2002
Posts: 2
MapPoint OCX control does not work on a .Net MDI form.

I have a .NET mdi application and I am trying to use the MapPoint control on one of the MDI child forms. However, when the control attempts to Open or Create a new map it throws the following exception:

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 10-22-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 10-23-2002
Junior Member
White Belt
 
Join Date: Oct 2002
Posts: 2
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...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-23-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 10-29-2002
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Actually I'm not surprised

I've seen other ActiveX controls that can't handle MDI child forms. Embedding an IE window on an MDIChild form exhibits similiar behavior.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 12-06-2002
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
control, form, mappoint, mdi, net, ocx, work


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 10:18 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54