It's common in web programming to place links to resources on a page. The hyperlink tag is on nearly every page on your website. But what about Windows Forms?
In .NET it is easy to add a hyperlink to a form. At least it looks and acts like a hyperlink.
- Add a LinkLabel to the form.
- Change the text to the web address (example http://www.waltritscher.com/ )
- In the LinkClicked event add one line of code.
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Process.Start(LinkLabel1.Text)
End Sub |
This works because Windows knows that a string with http:// is a web address and will launch the users default web browser. Process.Start merely asks Windows to launch a process based on the file/URL string being passed as parameter.