View Single Post

  #2 (permalink)  
Old 08-20-2002
John Meyer's Avatar
John Meyer John Meyer is offline
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
This code sample will: If you click your mouse on the map, if it is a location type it will give you a message box with the Lat/Lon.

Here is an article you need to check out: A More Compact Method for Obtaining Lat/Long. Author: Gilles Kohl

http://www.mp2kmag.com/articles.asp?ArticleID=13


'Put Gilles code in a bas module for the CalcPos function call.

'Put this in the general declatations section
Public thelat As Double
Public thelon As Double


'I'm using a Mappoint ActiveX Control named MappointControl1 on my form for this example


Private Sub MappointControl1_SelectionChange(ByVal pNewSelection As Object, ByVal pOldSelection As Object)
On Error GoTo error:
Dim objmap As MapPointCtl.Map
Dim objLoc As MapPointCtl.Location
Set objmap = MappointControl1.ActiveMap
If TypeOf objmap.Selection Is Location Then
Set objLoc = objmap.Selection

CalcPos objmap, objLoc, thelat, thelon
MsgBox thelat & " , " & thelon
End If

Exit Sub
error:
End Sub
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Reply With Quote