MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




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 ...


Go Back   MapPoint Forums > Map Forums > MP2K Magazine Articles

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-05-2002
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2006
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
mappoint, net, programming


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Ambiguous messages ( programming or not programming? ) Mohamed MapPoint 2006/2009 Discussion 1 06-13-2006 03:35 PM
C# samples for MapPoint programming tacaldo MapPoint 2006/2009 Discussion 3 03-21-2005 05:32 PM
Programming with MapPoint and license MFortier MapPoint 2006/2009 Discussion 8 06-21-2004 10:21 PM
In using MapPoint in programming with VB how do yo.... Anonymous MapPoint 2006/2009 Discussion 1 11-27-2001 01:53 AM
What is the "Programming Model" of Mappoint, and h.... Anonymous MapPoint 2006/2009 Discussion 1 08-27-2001 11:56 AM


All times are GMT -5. The time now is 10:57 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Tenerife Holiday
Find a great deal on a Tenerife holiday through UlookUbook! Check out the options online...



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