![]() ![]() | ||
In the previous topic, we linked to a form in the CreateLinkLabel example on the CD-ROM; in this topic, I'll add support for the other hyperlink in that example, which links to www.coriolis.com. You can recover the text "www.coriolis.com" from the clicked hyperlink with the e.Link.LinkData.ToString method, so you open the user's default browser and navigate to that URL this way:
Private Sub LinkLabel1_LinkClicked(ByVal sender As Object, _ ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) LinkLabel1.Links(LinkLabel1.Links.IndexOf(e.Link)).Visited = True If (e.Link.LinkData.ToString() = "info") Then Dim InfoWindow As New Form2() InfoWindow.Show() Else System.Diagnostics.Process.Start(e.Link.LinkData.ToString()) End If End Sub
Now when the user clicks the "here" hyperlink you see in Figure 5.17, the user's default browser opens and navigates to the Coriolis Web site.
![]() ![]() | ||