0

Hi,

I need to retrieve string from one form to another form. When I retrieved the latitude and longitude of my current location, I need to use my current latitude and longitude coordinates to link to another map form to display the map with my current location using the coordinates. I am this code, but I'm unable to link the coordinates to the map as I get the data from a string and I think I need to store the string somewhere before I can read the string from another form. How can I solve my problem?

This is my coding:

First form:

Private Sub btnMapIt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMapIt.Click

Dim f As New Map(Latitude, Longitude)
Dim lat, lon As String

If Latitude <> String.Empty And Longitude <> String.Empty Then

txtLat.Text = lat
txtLong.Text = lon

f.Show()

End If

End Sub

Second form:

Public Sub New(ByVal lat As String, ByVal lon As String)

InitializeComponent()

If (lat = String.Empty Or lon = String.Empty) Then
Me.Dispose()
End If

Try

Dim queryAddress As New StringBuilder()

If lat <> String.Empty AndAlso lon <> String.Empty Then
queryAddress.Append("http://maps.google.com/?q=" & lon & "," & lat)
End If

2
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by SSDD
0

Try this:
form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If txtLat.Text <> String.Empty And txtLong.Text <> String.Empty Then
            Dim f As New map(txtLat.Text, txtLong.Text)
            f.Show()
        End If
    End Sub

form2

Public Sub New(ByVal lat As String, ByVal lon As String)
        InitializeComponent()
        If (lat = String.Empty Or lon = String.Empty) Then
            Me.Dispose()
        Else
            TextBox1.Text = lat
            TextBox2.Text = lon
        End If
    End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.