Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 6 of 6

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

  1. #1
    clackclack is offline 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

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    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)

  3. #3
    clackclack is offline 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...

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    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).

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

  6. #6
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. the map is empty after Show/Hide form with MapPoint control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-25-2004, 03:24 PM
  2. Alignment of the control on my form
    By blackmap in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-25-2003, 01:43 AM
  3. How do I make a MapPoint COM+ AddIn form non modal?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-26-2003, 08:16 AM
  4. MapPoint Control align in Form
    By blackmap in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-06-2003, 10:26 AM
  5. Is it possible to save a MapPoint file in a form r....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-09-2002, 10:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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