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

Problem with vb.net

This is a discussion on Problem with vb.net within the MapPoint Desktop Discussion forums, part of the Map Forums category; I was able to show lan/lat infomation on status bar using private sub Mouse_move on .vb programming. Now I'm trying ...

  1. #1
    XRoK is offline Junior Member Yellow Belt
    Join Date
    May 2004
    Posts
    25

    Problem with vb.net

    I was able to show lan/lat infomation on status bar using private sub Mouse_move on .vb programming.
    Now I'm trying with vb.net, but lan/lat will not display correctly.
    I was able to show lan/lat by zoom in and zoom out, but it will not show under mouse_move.

    What am I missing?

    XRoK

  2. #2
    EdB
    EdB is offline Member Green Belt
    Join Date
    Aug 2002
    Posts
    56
    Post some code, let's have a look

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

    Code

    Ok,
    Here is the code for MouseMoveEvent

    Private Sub AxMappointControl1_MouseMoveEvent(ByVal sender As System.Object, ByVal e As AxMapPoint._IMappointCtrlEvents_MouseMoveEvent) Handles AxMappointControl1.MouseMoveEvent


    Dim oLoc As MapPoint.Location
    Dim dblLat As Double, dblLon As Double
    Dim strPos As String
    Dim strPosp As String
    Dim x As Integer
    Dim Y As Integer

    oLoc = oMap.XYToLocation(x, Y)

    CalcPos(oMap, oLoc, dblLat, dblLon)

    Statusbar.panel(1).text = dblLat & "/" & dblLon

    End Sub

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    I wonder if it is because your declaration of dblLat and dblLon is inside of your Private Sub AxMappointControl1_MouseMoveEvent ?

  5. #5
    XRoK is offline Junior Member Yellow Belt
    Join Date
    May 2004
    Posts
    25
    I think you went over my head..

    Can you explain little more in my level, which isn't much.


    XRoK

  6. #6
    brianmcg is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Posts
    17
    I'm a vb6 developer and haven't done anything with .net yet, but having said that, the XYtoLocation function must be passed the mouse coordinates in order to create the locations. In vb6, the event passes you the x and y of the mouse as parameters. You seem to be creating x and y as local variables and not assigning any values to them before calling the XYToLocation method. I may be missing something, but the way the code seems to work, you'll get the lat/long of whatever is in the top left corner of the map window (because that's (0,0) in the window and local integers are created with a value of 0) rather than anything to do with the mouse pointer.[/quote]

  7. #7
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Your right I dont see anything for setting the x.y either.

    Check out this article:
    Programming MapPoint via .NET
    http://www.mp2kmag.com/a66--location....mappoint.html

    Code:
    Private Sub OnMouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Integer, ByVal Y As Integer) Handles Map.MouseMove
    Notice this sub declaration the x and y get passed in by mappoint.

  8. #8
    EdB
    EdB is offline Member Green Belt
    Join Date
    Aug 2002
    Posts
    56
    I'm not sure if you got your answer yet, but I think it's here:

    dim x as integer = e.x
    dim y as integer = e.y

    Make those changes and you should be fine.

  9. #9
    XRoK is offline Junior Member Yellow Belt
    Join Date
    May 2004
    Posts
    25
    Thanks EDB!

    That's what i was missing..


  10. #10
    EdB
    EdB is offline Member Green Belt
    Join Date
    Aug 2002
    Posts
    56

Thread Information

Users Browsing this Thread

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

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