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

New to Mappoint programming-need control help!

This is a discussion on New to Mappoint programming-need control help! within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have been programming in VB 2005 for a year and want to incorporate MapPoint 2006 into the app. The ...

  1. #1
    Matman001 is offline Matman White Belt
    Join Date
    Aug 2007
    Location
    Houston,Tx.
    Posts
    4

    Question New to Mappoint programming-need control help!

    I have been programming in VB 2005 for a year and want to incorporate MapPoint 2006 into the app.
    The app is tabbed, and I want to place a map "window" for the users on a full size tab.
    I have read about the OCX and Control, but cannot figure out how to implement this correctly; using the control as a "Reference" and folowing the Mappoint_Demo instructions this launches Mappoint in its original form. I do not want to do that, I want to launch a limited map, feed by coordinates to position the location of the map, and allow for a few tools like zoom, print and a few more. It would be like launching "MapQuest" type view.

    Can someone help get me started with either loading a Mappoint Control to use from within the toolbox, or creating the code to launch a map as described above?

    I know allot of you are allot more advanced than this and I would be very greatful for any hrelp you can offer.

    Matt

  2. #2
    Matman001 is offline Matman White Belt
    Join Date
    Aug 2007
    Location
    Houston,Tx.
    Posts
    4

    Re: New to Mappoint programming-need control help!

    Nevermind- figured it out. Took the VB6 proj. and converted it in VB2005 and then added it to the toolbox. Now if I could just get it to zoom in on a particular state when it first opens. Any thoughts out there?

    MattS

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

    Re: New to Mappoint programming-need control help!

    Hi,
    if you want to focus the map, get a location object
    from findaddress etc. or fill it with longitude und latitude
    infos. Then use the GoTo()-Method and the Map
    will automatically focus. There is also an attribute that
    defines the distance from the earth, can't find it at the
    moment.

    If you want to make user inputs like move right or left,
    the map in mappointControl.ActiveMap already has useful
    functions.

    For printing use the printout method in the map object,
    beware, the printer (ActivePrinter) is set in the mappointControl.

    If you want to use the existing print dialog you have to
    send messages to the windows inside mappoint because
    this is a hidden feature. Made a thread about it last few days. (print dialog)
    Code is in C# but if you know the correspondent instructions
    in vb it may help, else look for the hidden feature thread.

    Hope this is a little bit of a guidance, hf

  4. #4
    Matman001 is offline Matman White Belt
    Join Date
    Aug 2007
    Location
    Houston,Tx.
    Posts
    4

    Re: New to Mappoint programming-need control help!

    Thank you for responding jasonite-

    Here is what I currently have.

    I am loading the control (MappointControl1) into form_load and form_closed and have the control placed onto the form. It works great. In researching, I have attempted to use the example:

    Dim objApp As MapPoint.Application
    Dim objLoc As MapPoint.Location
    Dim objMap As MapPoint.Map

    objApp = CreateObject(
    "MapPoint.Application")
    objMap = objApp.ActiveMap
    objApp.Visible =
    True
    objApp.UserControl = True
    objLoc = objMap.FindResults("Seattle, WA").Item(1)
    objLoc.GoTo()

    which works good too. The problem is that the code launches a second, full blown window of Mappoint- which I don't want. I want the control that is loaded in form_load to receive the "Goto" statement.

    Do you have any ideas on how I could do that? Also, I'm sure there must be a way in the full blown Mappoint window to retrieve long and lat's to use in the programming. Thats probably my next question.

    For the life of me this Mappopint programming is making me loopy.

    MattS


  5. #5
    Matman001 is offline Matman White Belt
    Join Date
    Aug 2007
    Location
    Houston,Tx.
    Posts
    4

    Re: New to Mappoint programming-need control help!

    ... and the clouds parted, and the Sun shown, and life again, was good.

    Load the control according to Using the MapPoint ActiveX Control; for VB2005 programmers use the conversion method described in the earlier communication below this one, then use this code to get the map to focus/zoom into a specific state upon launch, or in this case I used a button to test with. But I will be able to set this through another variable:

    PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles Button1.Click
    Dim objApp As MapPoint.Application
    Dim objLoc As MapPoint.Location
    Dim objMap As MapPoint.Map

    objApp = GetObject(,
    "MapPoint.Application")

    objMap = objApp.ActiveMap
    objLoc = objMap.FindResults("TX").Item(1)
    objLoc.GoTo()

    EndSub

    This appears to be an interesting mixture of VB6 and .net structures combined.

    Now, I'm on to the issue of coordinates ....

    MattS

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

    Re: New to Mappoint programming-need control help!

    Question is, where do you want to get coordinates from ^^

    If you got a Location object it already got this infos.
    You can get the location of the map, which is the
    center which your map is focused on. If you search
    for Places use address info and give it to the functions
    like FindAddress, you get a findresults back. GetEnumerator
    an walk through them to get the location you want
    (1st item is the best result).
    You can also make a event handler for the mousemove
    or selection change event. Mousemove gives you
    x/y coord of the visible map, then use functions on
    the map-object to convert this coords to long/lat coords.
    (can't remember the names, help file with mappoint delivered
    is a good reference for this, search for map-object etc.)
    selectionchange gives you elements which are
    selected oder were selected.

    I can post some code if you know what you want. But
    i'm just a newbie, there are a lot more experienced
    members.

    (help file: getting started with mappoint - has usefull infos
    also there is always a code snipped for methods and
    properties)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Best version of mappoint for .Net programming?
    By bcairns in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-10-2006, 10:40 AM
  2. Ambiguous messages ( programming or not programming? )
    By Mohamed in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-13-2006, 04:35 PM
  3. Programming MapPoint via .NET
    By Anonymous in forum MP2K Magazine Articles
    Replies: 1
    Last Post: 02-21-2006, 10:42 AM
  4. In using MapPoint in programming with VB how do yo....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-27-2001, 02:53 AM
  5. What is the "Programming Model" of Mappoint, and h....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-27-2001, 12:56 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 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