Home > DeveloperSection > Articles > LinkLabel in VB.Net

LinkLabel in VB.Net


VB.Net VB.Net 
Ratings:
0 Comment(s)
 9116  View(s)
Rate this:

LinkLabel in VB.Net

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.

LinkLabel in VB.Net

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

LinkLabel in VB.Net

When you click on the link Go to mindstick then LinkClicked event will fire and redirected to the www.mindstick.com.

LinkLabel in VB.Net

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.

LinkLabel in VB.Net

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.

LinkLabel in VB.Net


Don't want to miss updates? Please click the below button!

Follow MindStick