views:

582

answers:

3

I would like to pass and address to and open Bing Maps from a vb.net app. Anywhere I can find an example of how to do this?

A: 

Try the nerd dinner asp.net mvc tutorial. It's near the end and you can download a working example

http://tinyurl.com/aspnetmvc

No Refunds No Returns
+1  A: 

You're going to want to check out the Bing Maps Web Services SDK. It allows you to use Bing to Geocode (retrieve a location from an address) as well as Download Imagery Data. Another place for Bing developers information can be found here.

Edit: I just reread your question and I think you can do what you need using a simple string concatenation to create a url. This might work:

Dim MyURL As String
Dim Location As String
Location = "Pittsburgh, PA"
MyURL = "http://www.bing.com/maps/?v=2&where1=" + HttpUtility.UrlEncode(Location) + "&encType=1"
System.Diagnostics.Process.Start(MyURL)

My VB is a little rusty, but this should get you started. You will also need to import the System.Web Namespace for the HttpUtility Class.

Refrences:

kersny
I'm interested in the snipped you provided. I tried it but I'm getting "Interenet Explorer cannot display this page".
bochur1
It seemed to work for me, can you copy the URL out of the IE toolbar after it pops up?
kersny
Seems to be working now here too. Thaks. Anyway to have it open w/o the panel on the left that contains the address and other info?
bochur1
The only way I could see to do that would be to create your own web page with an embedded map using the http://www.microsoft.com/maps/isdk/ajax/
kersny
A: 

'In addition to kersney's example this uses the webbrowser control in a vb form

Imports System.Web

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim Location As String = "Pittsburgh, PA"
    Dim MyURL As String = "http://www.bing.com/maps/?v=2&where1=" + HttpUtility.UrlEncode(Location)
    Dim WebBrowser1 As New WebBrowser
    Me.WindowState = FormWindowState.Maximized 'maximize window
    Me.Controls.Add(WebBrowser1) 'add browser control
    WebBrowser1.Dock = DockStyle.Fill   'fill to form
    WebBrowser1.Navigate(MyURL) 'display page in form
End Sub
djbaldwin