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

newmap problem with Mappointcontrol in VB.NET

This is a discussion on newmap problem with Mappointcontrol in VB.NET within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I just started to test mappoint 2004 in VB.NET and have no experience in vb.net. I can put the ...

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

    newmap problem with Mappointcontrol in VB.NET

    Hi,

    I just started to test mappoint 2004 in VB.NET and have no experience in vb.net.

    I can put the mappointcontrol1 on the windows form , when I try to put code (in the form load event or button click event)

    mappointcontrol1.newmap =>still ok

    but when I add geoMapEurope this is not working anymore.

    ( Of course I installed mappoint 2004 europe)

    vb.net put a line under geoMapEurope and gives a debug error after starting.
    In vb6 it works perfect....
    What can I do?

    Thanks for help

    Wim

  2. #2
    NickS's Avatar
    NickS is offline Junior Member White Belt
    Join Date
    Nov 2003
    Posts
    10

    Try This...

    Place a MapPoint control on the form, and then add the following code to the 'Form1_Load':
    Code:
    Try
      MappointControl.NewMap(MapPoint.GeoMapRegion.geoMapEurope)
    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
    (In this example the control on the form is called 'MappointControl'.)

    You may want to try adding this code to a button to move to a specified lat/lon...
    Code:
    Dim objmap As MapPoint.Map
    Dim objLoc As MapPoint.Location
    Dim dblLat, dblLon As Double
    
    dblLat = Val(txtLat.Text) 'Or just put numbers here if no textboxes
    dblLon = Val(txtLon.Text)
    
    objmap = MappointControl.ActiveMap
    objLoc = objmap.GetLocation(dblLat, dblLon, Val(txtAlt.Text))
    objLoc.GoTo()
    (This uses three textboxes - txtLat,txtLon, and txtAlt for the lat,lon,and altitude for viewing the map.)

    Hope this helps...

    Nick

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

    newmap

    Hi Nick,

    Thanks for your help, this way it (NewMap) works!!

    I found out that Mappointcontrol.OpenMap("C:\test.ptm") works to if I save first a map.

    In the object browser I found that the OpenMap method needs a string as an argument but the NewMap method needs an object.

    I think this is the difference with vb6 no?

    Best regards,

    Wim

  4. #4
    NickS's Avatar
    NickS is offline Junior Member White Belt
    Join Date
    Nov 2003
    Posts
    10

    Newmap

    I've only started using MP2004 with VB.Net fairly recently, and looking round the web at sample code, it seems that there are quite a few 'subtle' changes in the syntax between MP2002 and 2004. Just to make it worse, most of the code 'in the wild' is for VB6, which doesn't really help very much!!

    You've probably just found your first example!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MapPointControl Windowless / VB6
    By Guido Mitschke in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 12-29-2005, 02:13 PM
  2. MapPointControl.ocx
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-25-2005, 10:46 AM
  3. map loading problem with MappointControl.ocx
    By yooishung in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-22-2004, 09:34 AM
  4. newmap
    By yvdp in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 05-21-2004, 05:48 PM
  5. newmap slower with mappointcontrol than with Mappoint2004 ?
    By Syd in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-21-2003, 11:52 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