find mileage using two zipcodes onlh

Anonymous
07-05-2003, 09:46 PM
Is it possible to find the mileage by using only a zipcode for starting point and then use a zipcode for destination. 8)

Joakim
07-08-2003, 03:30 PM
If you are using a city, postal code or place doesn't matter. You will always get a location object back that you can use to get your distance.

An example (Use a form with a MapPoint OCX, a textbox, a listbox and two commandbuttons where Command1 calculates the route and Command2 clear the route):
-------------------------------------------------
Dim MyRoute As MapPointCtl.Route

Private Sub Command1_Click()
If Not MyRoute Is Nothing Then
If MyRoute.Waypoints.Count > 1 Then
MyRoute.Calculate
Else
MsgBox "Need more Waypoints!", vbExclamation
End If
End If
End Sub

Private Sub Command2_Click()
Me.List1.Clear
MyRoute.Clear
Me.MappointControl1.ItineraryVisible = False
End Sub

Private Sub Form_Load()
Me.MappointControl1.NewMap MapPointCtl.geoMapEurope
Set MyRoute = Me.MappointControl1.ActiveMap.ActiveRoute
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim MyMap As MapPointCtl.Map
Dim MyResult As Object

Set MyMap = Me.MappointControl1.ActiveMap
If KeyCode = KeyCodeConstants.vbKeyReturn Then
Set MyResult = MyMap.ShowFindDialog(Me.Text1.Text)
If Not MyResult Is Nothing Then
If MyResult.Name > " " Then
Me.List1.AddItem MyResult.Name
MyRoute.Waypoints.Add MyResult, MyResult.Name
Me.Text1.Text = ""
End If
End If
End If
End Sub
-----------------------------------

/Joakim Tornhill
SpedSoft AB
http://www.spedsoft.se

 
Web mp2kmag.com
mapforums.com