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

vb6 to vb.net conversion woes

This is a discussion on vb6 to vb.net conversion woes within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi All In VB6 on form load of main form I have the following code mc1.OpenMap App.Path + "\MTMap.ptm" mc1.Units ...

  1. #1
    starbuck's Avatar
    starbuck is offline Member Green Belt
    Join Date
    Oct 2003
    Posts
    68

    vb6 to vb.net conversion woes

    Hi All

    In VB6 on form load of main form I have the following code

    mc1.OpenMap App.Path + "\MTMap.ptm"
    mc1.Units = geoMiles
    mc1.Visible = True
    mc1.ActiveMap.DragBehavior = 2
    mc1.ActiveMap.AllowEdgePan = True
    mc1.ItineraryVisible = False
    Map_Resize

    In vb.net I have the following

    mc1.OpenMap(MTDir + "\MTMap.ptm")
    mc1.Units = MapPoint.GeoUnits.geoMiles
    mc1.Visible = True
    mc1.ActiveMap.DragBehavior = 2
    mc1.ActiveMap.AllowEdgePan = True
    mc1.ItineraryVisible = False
    Map_Resize()

    And I get the following error on the first line - Exception of type InvalidActiveXStateException was thrown.

    Any thoughts folks, I am using a the ocx on the main form

    Thanks in advance

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    I believe you have to use NewMap for a new instance of the map object:

    mc1.NewMap(MTDir + "\MTMap.ptm")

    Roger

  3. #3
    starbuck's Avatar
    starbuck is offline Member Green Belt
    Join Date
    Oct 2003
    Posts
    68

    vb6 to vb.net conversion woes

    Thanks, will give that a go

  4. #4
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Sorry to mislead but you can use OpenMap, the following actually works:

    Public Class Form1
    Inherits System.Windows.Forms.Form

    Public objApp As AxMapPoint.AxMappointControl
    Public objMap As MapPoint.Map

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    objApp = AxMappointControl1
    objMap = objApp.NewMap("C:\TestMap.ptm")
    objMap = objApp.ActiveMap

    If objMap Is Nothing Then
    'handle errors
    Exit Sub
    End If

    'Then do everything via objApp and objMap.
    'Didn't need to set visible.

    End Sub

    I can't see the basic diference but it works if thats any help?

    Roger

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Please ignore previous posting this is what I should have said:

    Sorry to mislead but you can use OpenMap, the following actually works:

    Public Class Form1
    Inherits System.Windows.Forms.Form

    Public objApp As AxMapPoint.AxMappointControl
    Public objMap As MapPoint.Map

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

    objApp = AxMappointControl1
    objMap = objApp.OpenMap("C:\TestMap.ptm")
    objMap = objApp.ActiveMap

    If objMap Is Nothing Then
    'handle errors
    Exit Sub
    End If

    'Then do everything via objApp and objMap.
    'Didn't need to set visible.

    End Sub

    End Class

    I can't see the basic diference but it works if thats any help?

    Roger

  6. #6
    starbuck's Avatar
    starbuck is offline Member Green Belt
    Join Date
    Oct 2003
    Posts
    68

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. ED50 to wgs84 conversion
    By Nicou in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 12-15-2010, 06:39 AM
  2. Lat/Long conversion
    By klomp63 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-14-2006, 03:29 PM
  3. OLEVariant conversion
    By phoque in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-10-2005, 01:44 PM
  4. Help Re Conversion please
    By Ticker in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-09-2004, 11:25 AM
  5. Coordinate conversion
    By Matrices in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-03-2003, 08:13 AM

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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96