Get just Distance and Duration values

Feb 1, 2009 at 7:45 AM
Hi,

First of all-- awesome control.  Was using subgurim, but this is much more robust.

Many questions, but my first would be on Distance/Duration.  I need a way to get the driving distance from Point A to Point B.  I can do this through a manual postback, as your sample code showed how to do, but I'd like to pass 2 addresses in code behind to your API and have it output the driving distance.

Something like this:

Protected
Function DistanceCalc(ByVal fromLoc As String, ByVal toLoc As String) as string
Dim dir As GoogleDirection = New GoogleDirection(fromLoc & " to " & toLoc)
'Return String.Format("Distance: {0}<br/>Duration: {1}", dir.Distance.Html, dir.Duration.Html)
Return String.Format("Distance: {0}<br/>Duration: {1}", dir.Distance.Meters, dir.Duration.Seconds)
End Sub 


I'll I'm getting with the line that's commented out is nothing, and the line that's not commented out is returning 0.

Any help would be greatly appreciated.

-Nick