Click here to Skip to main content
15,893,564 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: View of application Pin
Bernhard Hiller27-Jan-12 5:17
Bernhard Hiller27-Jan-12 5:17 
GeneralRe: View of application Pin
Mangore7527-Jan-12 6:09
Mangore7527-Jan-12 6:09 
GeneralRe: View of application Pin
Richard MacCutchan27-Jan-12 6:20
mveRichard MacCutchan27-Jan-12 6:20 
AnswerRe: View of application Pin
Eddy Vluggen27-Jan-12 6:18
professionalEddy Vluggen27-Jan-12 6:18 
GeneralRe: View of application Pin
Mangore7527-Jan-12 6:22
Mangore7527-Jan-12 6:22 
Questionhow to set maximum gatagrid rows Pin
Long Bunly27-Jan-12 3:05
Long Bunly27-Jan-12 3:05 
AnswerRe: how to set maximum gatagrid rows Pin
Simon_Whale27-Jan-12 3:16
Simon_Whale27-Jan-12 3:16 
Questionhow to retrive Driving Times from google maps Pin
pinifg27-Jan-12 1:38
pinifg27-Jan-12 1:38 
Dear Developers

I am trying to retrieve driving time from Google maps,

I have 1200 locations and I need driving time between them and insert each combination into my database can someone please post a code that retrieve the data from Google?.
All the locations are from Israel and there is no postal code only cities names or main locations.

I tried modifying the following code which I found on the web in is in vb
But it doest work please help
In will appreciate any help on the subject

Tanks,

Patric




VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim str As String = getGoogDistanceTime("תל אביב", "באר שבע", "time")

    End Sub


   

    Public Function getHTML(ByVal strURL As String) As String
        'Returns the HTML code underlying a given URL
        Dim oXH As Object
        oXH = CreateObject("msxml2.xmlhttp")
        With oXH
            .Open("get", strURL, False)
            .send()
            getHTML = .responseText
        End With
        oXH = Nothing
    End Function

    Public Function parseGoog(ByVal strSearch As String, ByVal strHTML As String) As String
        strSearch = strSearch & ":"""
        If InStr(1, strHTML, strSearch) = 0 Then parseGoog = "Not Found" : Exit Function
        parseGoog = Mid(strHTML, InStr(1, strHTML, strSearch) + Len(strSearch))
        parseGoog = Mid(parseGoog, 1, InStr(1, parseGoog, """") - 1)
    End Function


    Public Function getGoogDistanceTime(ByVal rngSAdd As String, ByVal rngEAdd As String, Optional ByVal strReturn As String = "distance") As String
        Dim sURL As String
        Dim BodyTxt As String
        sURL = "http://maps.google.com/maps?f=d&source=s_d"
        sURL = sURL & "&saddr=" & Replace(rngSAdd, " ", "+")
        sURL = sURL & "&daddr=" & Replace(rngEAdd, " ", "+")

        sURL = sURL & "&hl=en"

        BodyTxt = getHTML(sURL)

        If InStr(1, BodyTxt, strReturn, vbTextCompare) = 0 Then
            getGoogDistanceTime = "Error"
        Else
            getGoogDistanceTime = parseGoog(strReturn, BodyTxt)
        End If
    End Function


modified 27-Jan-12 8:07am.

AnswerRe: how to retrive Driving Times from google maps Pin
Bernhard Hiller27-Jan-12 5:23
Bernhard Hiller27-Jan-12 5:23 
GeneralRe: how to retrive Driving Times from google maps Pin
pinifg27-Jan-12 22:12
pinifg27-Jan-12 22:12 
QuestionForm shows smoothly ( vb.net ) Pin
Framework .l.26-Jan-12 17:51
Framework .l.26-Jan-12 17:51 
AnswerRe: Form shows smoothly ( vb.net ) Pin
Eddy Vluggen27-Jan-12 6:16
professionalEddy Vluggen27-Jan-12 6:16 
GeneralRe: Form shows smoothly ( vb.net ) Pin
JR21227-Jan-12 17:23
JR21227-Jan-12 17:23 
QuestionCreate a Data-Relation using Entities? Pin
nlarson1126-Jan-12 10:48
nlarson1126-Jan-12 10:48 
AnswerRe: Create a Data-Relation using Entities? Pin
Eddy Vluggen27-Jan-12 6:14
professionalEddy Vluggen27-Jan-12 6:14 
GeneralRe: Create a Data-Relation using Entities? Pin
nlarson1128-Jan-12 3:51
nlarson1128-Jan-12 3:51 
QuestionRun-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
rizaky201125-Jan-12 18:55
rizaky201125-Jan-12 18:55 
AnswerRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
Dave Kreskowiak26-Jan-12 1:52
mveDave Kreskowiak26-Jan-12 1:52 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
rizaky201126-Jan-12 14:30
rizaky201126-Jan-12 14:30 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
Dave Kreskowiak26-Jan-12 16:00
mveDave Kreskowiak26-Jan-12 16:00 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
rizaky201129-Jan-12 19:06
rizaky201129-Jan-12 19:06 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
Dave Kreskowiak30-Jan-12 2:01
mveDave Kreskowiak30-Jan-12 2:01 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
rizaky201130-Jan-12 14:02
rizaky201130-Jan-12 14:02 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
Dave Kreskowiak30-Jan-12 15:21
mveDave Kreskowiak30-Jan-12 15:21 
GeneralRe: Run-time error '-2147217913 (80040e07)': Data type mismatch in criteria expression Pin
rizaky201130-Jan-12 16:59
rizaky201130-Jan-12 16:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.