Hey, wenn ich mit Google eine entfernung errechnen will:
ist label57 leider gleich "0"
wenn ich anstatt
If objMc.Count Then entfernung = objMc(0)
einfach
entfernung = objMc(0)
kommen drei error:
Eine Ausnahme (erste Chance) des Typs "System.NullReferenceException" ist in Microsoft.VisualBasic.dll aufgetreten.
Eine Ausnahme (erste Chance) des Typs "System.ArgumentException" ist in Microsoft.VisualBasic.dll aufgetreten.
Eine Ausnahme (erste Chance) des Typs "System.ArgumentException" ist in Microsoft.VisualBasic.dll aufgetreten.
VB.NET-Quellcode
- Dim entfernung As Integer
- bisPLZ = TextBox5.Text
- vonPLZ = "21629"
- If Not (bisPLZ Like "#####" = True) Then
- MsgBox("Keine gültige Postleitzahl!")
- End If
- IEApp = CreateObject("InternetExplorer.Application")
- IEApp.Visible = False
- objRe = CreateObject("vbscript.regexp")
- objRe.Pattern = "^(\d+(?:[\D]\d+)? km . .*Minuten)$"
- objRe.MultiLine = True
- Dim IEDocument As Object
- Dim objMc As Object
- IEApp.Navigate("http://maps.google.de/maps?f=d&hl=de&geocode=&saddr=" & vonPLZ & "&daddr=" & bisPLZ & "&output=html")
- Do : Loop Until IEApp.Busy = False
- Do : Loop Until IEApp.Busy = False
- IEDocument = IEApp.Document
- objMc = objRe.Execute(IEDocument.Body.innerText)
- If objMc.Count Then entfernung = objMc(0)
- objMc = Nothing
- IEDocument = Nothing
- IEApp.Quit()
- Label57.Text = entfernung
ist label57 leider gleich "0"
wenn ich anstatt
If objMc.Count Then entfernung = objMc(0)
einfach
entfernung = objMc(0)
kommen drei error:
Eine Ausnahme (erste Chance) des Typs "System.NullReferenceException" ist in Microsoft.VisualBasic.dll aufgetreten.
Eine Ausnahme (erste Chance) des Typs "System.ArgumentException" ist in Microsoft.VisualBasic.dll aufgetreten.
Eine Ausnahme (erste Chance) des Typs "System.ArgumentException" ist in Microsoft.VisualBasic.dll aufgetreten.