Export (0) Print
Expand All

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.

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

This example requires:

  • A Windows Form named Form1.

  • A LinkLabel control named LinkLabel1.

  • An active Internet connection.

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

Show:
© 2014 Microsoft