Reputation: 5
I'm a newbie writing my first app. I need help with the following: I need to retrieve the logged in user which = GID, I then need to append it to a URL which will start our Help Desk chat client. I can retrieve the GID easy enough but can't figure out how to append it and pass it with the URL. I found a post which instructed to declare the url as a string also and concatenate it. The UserName would follow the ":" at the end of the Url.
Private Sub GID()
Dim GID As String
GID = System.Environment.UserName
' System.Diagnostics.Process.Start("http://www.myurl.com/eschat/arhome.html?login=m:uid~uid:")
We use javascript to do this from the HelpDesk site, but I need to adapt it to work from my app. Any help would be appreciated and I hope my question makes sense.
Upvotes: 0
Views: 1640
Reputation: 1775
You can concatenate strings in VB.NET using '&' like this:
Dim GID as String
GID = System.Environment.UserName
Dim URL as String
URL = "http://www.myurl.com/eschat/arhome.html?login=m:uid~uid:"
System.Diagnostics.Process.Start(URL & GID)
You can also insert the variable into the string like this
URL = String.Format("http://www.myurl.com/eschat/arhome.html?login=m:uid~uid:{0}", GID)
and the GID will be placed wherever the "{0}" is, this can also be used for multiple parameters, you just increment the number inside the curly braces e.g. "{1}", "{2}".
MSDN article here.
Upvotes: 1