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

Programming MapPoint via .NET

This is a discussion on Programming MapPoint via .NET within the MP2K Magazine Articles forums, part of the Map Forums category; This article explains how to use VB.NET to create an improved location sensor for MapPoint. DnClipPos can copy the current ...

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

    Programming MapPoint via .NET

    This article explains how to use VB.NET to create an improved location sensor for MapPoint. DnClipPos can copy the current lat/lon to the clipboard, and supports configurable display formats.

    Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=66

  2. #2
    gkirbo is offline Junior Member Yellow Belt
    Join Date
    Feb 2006
    Posts
    13

    BeforeClick Event Error

    I'm trying to make your code work in Visual Basic Express 2005 and i'm having trouble with the Event Handlers in DnClipPos... to simplify matters i took problem snippets from DnClipPos and moved them to an independent form (i describe this in the next paragraph). The error i keep getting no matter how i try relates to the three event handlers in DnClipPos (and short snippet test)... i tried using the automatic event code generator by going out to the form design tab and selecting my AxMapPoint control and then going to properties and double clicking on the BeforeClick event handler... which automatically generates an event handler in the Form1 code... however this event handler doesn't capture the mouse location with the X and Y variables... when i try to change the code to resemble yours i get errors and when i use the MapPoint 2004 HELP example of how to handle the BeforeMouse click event it doesn't work either. I'm not very good with OOP and so i think my errors may be a simple structural issue... but i'm stumped. Can you help?

    I have a form with a Command Button on it and a MapPoint DotCom Component Map Placed on the form… named AxMappointControl1. I’m trying to capture the screen coordinates of the mouse pointer over the mappoint map. I get a build Error with the word “BeforeClick” underlined in my code.

    The ERROR message is as follows:
    Error 1 Event 'BeforeClick' cannot be found.
    Help says the Error Code is BC30590


    MY CODE IS AS FOLLOWS:

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click

    Me.AxMappointControl1.OpenMap("C:\maps\BAD.ptm")
    Dim WithEvents oMap As MapPoint.Map = Me.AxMappointControl1.ActiveMap

    End Sub

    Private Sub OnClick(ByVal Button As Integer, ByVal Shift As Integer,
    ByVal X As Integer, ByVal Y As Integer, ByRef Cancel As Boolean) Handles
    oMap.BeforeClick

    Dim oResults As MapPoint.FindResults

    Cancel = True ' Do not perform the usual action on click
    Dim oLoc As MapPoint.Location
    Set oLoc = oMap.XYToLocation(X, Y)
    If Not (oLoc Is Nothing) Then oLoc.GoTo

    End Sub

    End Class




    I HAVE MADE THIS CODE WORK..

    Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click


    Me.AxMappointControl1.OpenMap("C:\maps\BAD.ptm")
    Dim map As MapPoint.Map = Me.AxMappointControl1.ActiveMap

    End Sub


    Private Sub AxMappointControl1_BeforeClick(ByVal sender As
    System.Object, ByVal e As AxMapPoint._IMappointCtrlEvents_BeforeClickEvent)
    Handles AxMappointControl1.BeforeClick

    MsgBox("This Works")

    End Sub

    End Class


    Can someone help me with the event error?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Ambiguous messages ( programming or not programming? )
    By Mohamed in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-13-2006, 04:35 PM
  2. C# samples for MapPoint programming
    By tacaldo in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 03-21-2005, 06:32 PM
  3. Programming with MapPoint and license
    By MFortier in forum MapPoint Desktop Discussion
    Replies: 8
    Last Post: 06-21-2004, 11:21 PM
  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