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

MapPoint 2006 ActiveX with Form.Close

This is a discussion on MapPoint 2006 ActiveX with Form.Close within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, me again. Form form1 = new Form(); AxMappointControl mapPoint = new AxMappointControl(); form1.Controls.Add(mapPoint); mapPoint.EndInit(); mapPoint.NewMap(2); ... Calculate Route etc., ...

  1. #1
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Question MapPoint 2006 ActiveX with Form.Close

    Hi, me again.

    Form form1 = new Form();
    AxMappointControl mapPoint = new AxMappointControl();
    form1.Controls.Add(mapPoint);
    mapPoint.EndInit();
    mapPoint.NewMap(2);
    ...
    Calculate Route etc., to put it simple - some Data is inserted
    ...
    form1.Show();

    Now i want that when the form is closed, that the Data still
    stays with my ActiveX Control and i can make further
    operations. Maybe after that display it on another form.

    // After
    form1.Close();
    // and
    form2.Controls.Add(mapPoint);
    mapPoint.EndInit();
    // i make a operation that returns the
    // ActiveRoute
    mapPoint.ActiveMap.ActiveRoute

    InvalidComObjectException - A Com-Object, which was disconnected
    from the basis of RCW, can't be used - in the AxMapPoint.cs:
    return this.ocx.ActiveMap; //Exception at that part

    I think it got something to do with the Close-Method.

    Any suggestions or solutions to this problem?

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: MapPoint 2006 ActiveX with Form.Close

    Hi,

    As far as I know you cannot disconect an ActiveX and reconnect later. So I think the best solution is to geve it an Owner that stay alive during the lifetime of the program. For example your main form. Just pass it to the constructor of your class. You see example in my reply to your other post where I do something similar.

  3. #3
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Re: MapPoint 2006 ActiveX with Form.Close

    Hi,

    jep, didn't find a solution, i let my class have an
    form which can be used before the other form is
    closed. But got to do this step first by myself,
    no secure way to make sure it won't be closed
    before ^^

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: MapPoint 2006 ActiveX with Form.Close

    Hi,

    Take the main form. You are sure is stay alive during lifetime of the application

  5. #5
    jasanite is offline Member Yellow Belt
    Join Date
    Jul 2007
    Posts
    45

    Re: MapPoint 2006 ActiveX with Form.Close

    Hmm, can i give the owner to the main form but the
    map will keep on apearing on the DockPanel thats floating
    around.
    Don't think so ... surprise me ^^

  6. #6
    jlewis is offline Member Yellow Belt
    Join Date
    Apr 2006
    Posts
    33

    Re: MapPoint 2006 ActiveX with Form.Close

    You could save the map as a .ptm when you close the form - then when you need it again, load the .ptm back into a 'new' control - that's what I do...
    John Lewis

  7. #7
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: MapPoint 2006 ActiveX with Form.Close

    Hi,

    Not the owner of the main form, but the main form itself !
    you could also create a Control that stay alive during the time it should be and give it as Owner, and destroy it when no longer needed

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mappoint and Access with ActiveX On A Form
    By jpateusa in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 05-16-2009, 07:32 PM
  2. MapPoint 2006 with ActiveX
    By jasanite in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 08-10-2007, 11:05 AM
  3. MapPoint 2006 ActiveX with new Form
    By jasanite in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-01-2007, 04:09 AM
  4. Mappoint 2006 ActiveX Questions
    By ben_dillon in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 01-31-2007, 07:16 AM
  5. mapPoint 2006 activex control slow down form closing
    By bule in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-26-2006, 02:22 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 26 27 28 29 30 31 32 33 34 35 36