Riute between Postcodes using VB.net

Enigma
01-07-2007, 04:43 AM
Hi all

Can anyone point me towards some example code to enable a route to be generated between two postcodes please using VB.net, Mappoint 2006

Many thanks Pete

Wilfried
01-07-2007, 11:07 AM
Hi,

C# but you can easy translate it into vb.net. this is from the top of my head so there may be errors in it, but should get you started:

FindResults results = MP.ActiveMap.FindAddressResults(street, city, othercity, region, zip, country);
if (results.ResultsQuality <= GeoFindResultsQuality.geoAmbiguousResults)
foreach (object o in results)
Location loc = o as Location;
if (loc != null) {
wp = route.Waypoints.Add(loc, nameFirstPoint);
wp.SegmentPreferences = GeoSegmentPreferences.geoSegmentPreferred;
break;

Then do so for the other point. At last you call route.Calculate()

Enigma
01-07-2007, 12:49 PM
Hi!

Thanks Wilfried, I`ll give this a try and let you know.

Many thanks Pete

 
Web mp2kmag.com
mapforums.com