LinkLabel is a class which is derived from label class so it has all the functions of label class. But LinkLabel also works as a hyperlink.
Drag and drop LinkLabel control from toolbox on the window Form.
Code:
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
'after visiting site LinkLabel color changed which will indicate that you have visited this site
LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start("www.mindstick.com")
'using the start method of system.diagnostics.process class
'process class gives access to local and remote processes
End Sub
System.Diagnostics.Process.Start
The System.Diagnostics namespace exposes a Process class that you can use to launch external programs.You can launch a new process with the shared Process.Start method, passing it either the name of an executable file or a filename with an extension associated with an executable application.
Run the project
When you click on the link Go to mindstick then LinkClicked event will fire and redirected to the www.mindstick.com.
LinkLabel Properties:
LinkBehaviour: Behaviour of link can be changed through LinkBehaviour properties LinkLabel.
Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Disable Underline
LinkLabel1.LinkBehavior = LinkBehavior.NeverUnderline
End Sub
Now when application run then Underline will not show in LinkLabel.
BackColor:
Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'change LinkLabel backcolor
LinkLabel1.BackColor = Color.Salmon
End Sub
BackColor will be changed at run time.
Leave Comment