Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Programming MapPoint via .NET Read the full article: http://www.mp2kmag.com/articles.asp?ArticleID=66 |
| |||
| 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? |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |
Flights from Edinburgh
Book flights from Edinburgh to exotic destinations all over the globe. Holiday Hypermarket will search for the latest great deals, so you don't have to.
Greece Weather
Check Turkey Weather before you travel. We provide information on Turkey including weather, flights and accommodation.
Flight to Canada
Book a flight to Canada to explore one of the most exciting travel destinations in the world. There are loads of interesting cities but some even more impressive natural beauty.
Cuba Holidays
Cuba holidays offer an exciting cultural and wonderful culinary experience. Book with The Holiday Place for a great deal.
Balearics
Before booking to the Balearics Islands make sure you check out our travel guide online. The Balearics are renowned for their vibrant nightlife but there are also some stunning Gothic cathedrals, Stone Age ruins and fishing villages.
Travel
Before making a choice regarding travel, check out the amazing variety of options on Travel.co.uk.
Holidays to Lanzarote
Not been to the Canary Islands yet? What are you waiting for! Get information on holidays to Lanzarote at On The Beach.