Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I give the latitude and longitude values in the link after q=

I need to get the Lat + Lng values instead of q=51.28333299869885+4.416667002695409&t=h&z=17

VB
Private Sub Cmd_Openinmap_Click(sender As Object, e As EventArgs) Handles Cmd_Openinmap.Click
        Dim Lat As String = Txt_Map_Latitude.Text
        Dim Lng As String = Txt_Map_Longitude.Text

        Process.Start("http://maps.google.com/maps?q=51.28333299869885+4.416667002695409&t=h&z=17")
    End Sub


Please Guide
Posted
Comments
Tomas Takac 12-Nov-14 7:14am    
Just to confirm, is the question really about concatenating strings in VB.NET?
Bensingh 12-Nov-14 7:28am    
I am new to .net its not a matter i need the values of the longitude and latitude
what i have given it may add to the process start URl

1 solution

A mix of techniques: Regex [^]and Split [^]
Imports System
Imports System.Text.RegularExpressions		
Public Module Module1
	Public Sub Main()
	Dim querystring As String = "q=51.28333299869885+4.416667002695409&t=h&z=17"
	Dim pattern As String = "(?<=q=)\d+\.\d+\+\d+\.\d+(?=&)"
	Dim m As Match = Regex.Match(querystring, pattern)
    Console.WriteLine(m)
	Dim latlng As String() = m.ToString().Split(New Char() {"+"c})
	Console.WriteLine(latlng(0))
	Console.WriteLine(latlng(1))
	End Sub
End Module

Read more: The 30 Minute Regex Tutorial[^]
 
Share this answer
 
v2
Comments
Bensingh 12-Nov-14 7:34am    
Private Sub Cmd_Openinmap_Click(sender As Object, e As EventArgs) Handles Cmd_Openinmap.Click
Dim Lat As String = Txt_Map_Latitude.Text
Dim Lng As String = Txt_Map_Longitude.Text
Process.Start("http://maps.google.com/?q=lat+lng&t=h&z=17")
End Sub

I have to get the lat and lng values in the url
Peter Leow 12-Nov-14 7:37am    
Run my sample code in a console to understand it.

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