Click here to Skip to main content
16,023,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends
I developed gps application in smart device using C#, in that i am getting the GPS data i converted GPS data into latitude and longitude in different text box for this no problem.

when i trying to locate position in the map using this latitude and longitude for this i used web browser it give errors it not locating the present position in the map.

please send the solution
i am sending errors also:

none
Error   1   The best overloaded method match for 'System.Windows.Forms.WebBrowser.Navigate(System.Uri)' 
has some invalid arguments  C:\Documents and Settings\User\Desktop\project\Tracking\Tracking\Form1.cs   322 17  
Tracking 

Error   2   Argument '1': cannot convert from 'string' to 'System.Uri' 
C:\Documents and Settings\User\Desktop\project\Tracking\Tracking\Form1.cs   
322 38  Tracking




My code is:
C#
private void getmap_Click(object sender, EventArgs e)
{
    webBrowser1.Show();
    if (currentLatitudeTbx.Text == string.Empty || currentLongitudeTbx.Text == string.Empty)
    {
        MessageBox.Show("Supply a latitude and longitude value", "Missing Data");
        return;
    }
    try
    {
        string lat = string.Empty;
        string lon = string.Empty;

        StringBuilder queryAddress = new StringBuilder();
        queryAddress.Append("http://maps.google.com/maps?q=");
        if (currentLatitudeTbx.Text != string.Empty)
        {
            lat = currentLatitudeTbx.Text;
            queryAddress.Append(lat + "%2C");
        }
        if (currentLongitudeTbx.Text != string.Empty)
        {
            lon = currentLongitudeTbx.Text;
            queryAddress.Append(lon);
        }
        webBrowser1.Navigate(queryAddress.ToString());

    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message.ToString(), "Error");
    }
 }

[Corrected code formatting]
Posted
Updated 10-Mar-10 8:00am
v5

1 solution

Try this:

webBrowser1.Navigate(new Uri(queryAddress.ToString()));


Your problem is that you're trying to pass a string to a method that's expecting a Uri object.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900