You need to use the link label's "LinkedClicked" event and do something like the following (LinkLabel1 is the name of my link label):
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start(LinkLabel1.Text) End Sub
This should open whatever your link is in your default web browser.
I was trying like things like: System.Windows.Forms.Webbrowser and I had a look at this other one using a with statement (which I don't understand).
If (Not WebBrowser1.Document Is Nothing) Then With WebBrowser1.Document ' If this is called first, the window will only have a status bar. .Window.Open(New Uri("http://www.microsoft.com/"), "displayWindow", "status=yes,width=200,height=400", False) End With End If
As far as I'm aware, the WebBrowser control is only displayed on your form and won't open a new window for you.
If you want to use the WebBrowser, then you can open web pages by calling the Navigate() function and passing in a string representing your URL. I'm no expert on it's usage but that's always worked for me.
How do I open a url by clicking on a link label?
xRuntime
You need to use the link label's "LinkedClicked" event and do something like the following (LinkLabel1 is the name of my link label):
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
System.Diagnostics.Process.Start(LinkLabel1.Text)
End Sub
This should open whatever your link is in your default web browser.
Hope that helps a bit, but sorry if it doesn't
archangel82
Thanks a bunch. I decided to make it the AccessibleDescription of my link label because I didn't want the url to show as the text.
System.Diagnostics.Process.Start(lnklbl_web.AccessibleDescription)
I was trying like things like: System.Windows.Forms.Webbrowser and I had a look at this other one using a with statement (which I don't understand).
If (Not WebBrowser1.Document Is Nothing) Then
With WebBrowser1.Document
' If this is called first, the window will only have a status bar.
.Window.Open(New Uri("http://www.microsoft.com/"), "displayWindow", "status=yes,width=200,height=400", False)
End With
End If
Thanks again.
Ingrid Vangkilde
Yeah I remember using that when I was doing a Microsoft tutorial, where the project was a web browser.
Jing
As far as I'm aware, the WebBrowser control is only displayed on your form and won't open a new window for you.
If you want to use the WebBrowser, then you can open web pages by calling the Navigate() function and passing in a string representing your URL. I'm no expert on it's usage but that's always worked for me.