How to: Display a Web Page from a Windows Forms LinkLabel Control (Visual Basic)

This example displays a Web page in the default browser when a user clicks a Windows Forms LinkLabel control.

Example

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
    LinkLabel1.Text = "Click here to get more info."
    LinkLabel1.Links.Add(6, 4, "www.microsoft.com")
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal _
e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles _
LinkLabel1.LinkClicked
    System.Diagnostics.Process.Start(e.Link.LinkData.ToString())
End Sub

Compiling the Code

This example requires:

  • A Windows Form named Form1.

  • A LinkLabel control named LinkLabel1.

  • An active Internet connection.

Security

The call to the Start method requires full trust. For more information, see SecurityException.

See Also

Reference

LinkLabel

Other Resources

LinkLabel Control (Windows Forms)