我已经编写了这段代码,允许用户点击我的地图按钮然后将它们带到Bing地图,这是我最初使用谷歌地图时的唯一问题,而地址会自动填充搜索字段并完成对我的搜索,我最近不得不切换到bing地图,因为谷歌地图会冻结,并告诉我它不受支持。我想知道除了我的代码之外还要添加什么,以允许bing自动搜索它从我链接到的字段中收集的信息。
Private Sub BTNMap_Click(sender As Object, e As EventArgs) Handles BTNMap.Click
Form2.Show()
' Search google maps for the exchange
Dim Postcode As String = PostcodeTextBox.Text
Dim Address As String = AddressTextBox.Text
Try
Dim queryAddress As New StringBuilder
queryAddress.Append("http://www.bing.com/maps/?")
If PostcodeTextBox.Text <> String.Empty Then
queryAddress.Append(Postcode + "," & "+")
End If
If AddressTextBox.Text <> String.Empty Then
queryAddress.Append(Address + "," & "+")
End If
Form2.Internet.Navigate(queryAddress.ToString)
Catch ex As Exception
MessageBox.Show("Unable to retrieve data")
End Try
End Sub
答案 0 :(得分:0)
有几个选项 - 您可以阅读Bing API上的文档,您可以阅读Google API上的文档,或者您可以查看Google Maps search URL并从中获取文档有:
' Search google maps for the exchange
Dim Postcode As String = PostcodeTextBox.Text
Dim Address As String = AddressTextBox.Text
Try
Dim queryAddress As New StringBuilder
queryAddress.Append("https://www.google.com/maps/place/")
If AddressTextBox.Text <> String.Empty Then
queryAddress.Append(String.Join("+", Address.Split(" ".ToCharArray(), _
StringSplitOptions.RemoveEmptyEntries)))
End If
If PostcodeTextBox.Text <> String.Empty Then
queryAddress.Append("+" & PostcodeTextBox.Text)
End If
Form2.Internet.Navigate(queryAddress.ToString)
Catch ex As Exception
MessageBox.Show("Unable to retrieve data")
End Try