Getting latitude and longitude from an address/postal code string

I have a database with postal code and address fields in a user table.  I want to plot these into a Virtual Earth Map control in Visual Studio but it seems like I can only give it a longitude/latitude as the parameters.

This table grows dynamically so I can't statically plot all the long/lat data myself in the table.

Is there a way that I can programatically (C#) get the long/lat from just a postal/zip code or address string before creating the markers on the maps?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the Virtual Earth control has no post code lookup facility then you will have to get the information from an external database.

I know when you run an address/post code search on Live Maps it refers to the location by latitude and longitude in the "cp" query string variable.when you click on share.
There may be a way of doing this programatically in order to get the information you require.
tekticianAuthor Commented:
Yea I have been looking for an external service.

I'm making a request to for now.

It seems to be working with the exception that the look ups are a little inaccurate sometimes.
tekticianAuthor Commented:
I find that using the Yahoo Geocode service is a lot more accurate than

I am still interested in taking on a method that uses the Map class of Virtual Earth in  However, if anyone is interested in the Yahoo Geocode method, I made a sample look up in the following code:

        double longitude = 0;
        double latitude = 0;
        string url = "";
        string postalCode = "V5T 1V9";
        url += postalCode;
        WebResponse response;
        WebRequest request = WebRequest.Create(new Uri(url));
        response = request.GetResponse();
        XmlTextReader reader = new XmlTextReader(response.GetResponseStream());
        XNamespace xmlns = XNamespace.Get("urn:yahoo:maps");
        var loc = (from ll in XDocument.Load(reader).Elements(xmlns + "ResultSet").Elements(xmlns + "Result")
                  select new
                      Latitude = ll.Element(xmlns + "Latitude").Value,
                      Longitude = ll.Element(xmlns + "Longitude").Value
        latitude = Convert.ToDouble(loc.Latitude);
        longitude = Convert.ToDouble(loc.Longitude);
        LatLongWithAltitude l = new LatLongWithAltitude(latitude, longitude);
        Shape shape = new Shape(ShapeType.Pushpin, l);
        shape.Title = "Test";

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.