MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Programming in VB.Net

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


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

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 11-25-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Programming in VB.Net

I'm just starting with VB.Net and MapPoint 2004. The code on MSDN doesn't seem to work for me though! I suspect it's differences between VB6/VB.Net and also MapPoint2002/2004.

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 error is: 'The requested member of the collection does not exist. Use a valid name or index number.'

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
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 11-25-2003
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 11-25-2003
NickS's Avatar
Junior Member
White Belt
 
Join Date: Nov 2003
Posts: 10
Can you be more specific? The MSDN help for FindLocation is ok - but the MSDN FindNearby help gives the code that I've already got (Using FindResults)!

Thanks

Nick
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 12-01-2003
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
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
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
programming, vbnet


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


All times are GMT -5. The time now is 12:37 AM.


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

Florida Holiday
Book your Florida holiday through UlookUbook and save cash!



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