Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Programming in VB.Net within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I'm just starting with VB.Net and MapPoint 2004. The code on MSDN doesn't seem to work for me though! I ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Programming in VB.Net I'm trying to give a location in Lat/Lon, and return a list of attributes at that location. I can get a map, and place pushpins ok, but the next part is causing an error. The code I have so far (to find 1 location) is: Code: 'Get a location on the map
oloc = omap.FindResults("51.577141, 0.291178").Item(1)
'Find nearby places 0.5 miles from that location
MsgBox("Closest place: " + oloc.FindNearby(0.5).Item(1).Name)
The above code came straight off MSDN. Can anyone help with this problem, or expand the code to produce a full list of attributes at that location? Thanks Nick |
| ||||
|
You need to use the "GetLocation method" insted of "FindResults Method"
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| ||||
|
The reason you got the error (The requested member of the collection does not exist. Use a valid name or index number) is because there was not anything nearby. Try this example. Put this code in a command button and see if it works better. It should find Pushpin1. Code: Try
Dim omap As MapPoint.Map
omap = AxMappointControl1.ActiveMap
Dim oloc As MapPoint.Location
Dim opin As MapPoint.Pushpin
oloc = omap.GetLocation(51.577141, 0.291178, 250)
opin = omap.AddPushpin(oloc, "Pushpin1")
opin.BalloonState = MapPoint.GeoBalloonState.geoDisplayBalloon
opin.Location.GoTo()
'Find nearby places 0.5 miles from that location
MsgBox("Closest place: " + oloc.FindNearby(0.5).Item(1).Name)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
![]() |
| Tags |
| programming, vbnet |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming using excel VBA... No GPS | KUSteveo | MapPoint 2006/2009 Discussion | 5 | 09-20-2008 01:33 PM |
| Ambiguous messages ( programming or not programming? ) | Mohamed | MapPoint 2006/2009 Discussion | 1 | 06-13-2006 03:35 PM |
| Programming MapPoint via .NET | Anonymous | MP2K Magazine Articles | 1 | 02-21-2006 09:42 AM |
| How to programming using VC6.0 | confach | MapPoint 2006/2009 Discussion | 4 | 03-01-2004 05:25 AM |
| In using MapPoint in programming with VB how do yo.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-27-2001 01:53 AM |