LinkLabel in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the LinkLabel control


LinkLabel

The LinkLabel control displays a label that is associated with a hyperlink, and by default it's blue and underlined. In addition when you mouse over this control it displays a pointing hand cursor, which makes it easy to be recognized as a link on a web page.

If you click the LinkLabel, it raises its LinkClicked event, so you can take whatever action is appropriate.

For example, you could show another form, or open a web page.

example

    Private Sub LinkLabel1_LinkClicked(sender As Object, _
                   e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        ' open the website URL set to the Tag property
        ' (www.visual-basic-tutorials.com)
        Process.Start(LinkLabel1.Tag.ToString)
    End Sub


It also provides some properties for determining the appearance of the link.

The LinkColor property defines the color of a normal link.

The LinkVisited property is a Boolean that indicates whether the link will be displayed as visited.

The VisitedLinkColor property defines the color of a visited link.

The LinkBehavior property determines when the link is underlined, and can take the values AlwaysUnderline, HoverUnderline, NeverUnderline, and SystemDefault.

Previous Lesson | Next Lesson


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.