C# Programming > Web

C# Hyperlink Button

C# Hyperlinks

A C# Hyperlink button control is a simple way to launch web links using only C#.NET. The concept is pretty simple and is fairly dynamic, making it adaptable to other C# projects.

This article will only make use of the built-in .NET Framework to work with label hyperlinks in C#.

HyperLink User Interface

The C# label hyperlink UI is easily represented with a LinkLabel control. It is basically a mix between a Label and a Button that is made to look like a web link. The nice part is that the three main colors are adjustable: normal color, active color, and visited color. Thus you can make the C# hyperlink behave like any normal link.

Launching the Web

Once you have the user interface set up (and note, that the LinkLabel can do anything, it doesn't have to just launch a hyperlink) it is time to make it launch a hyperlink.

Luckily the .NET Framework handles all the work for us. A URL address can be treated as a normal system file. What this means is that the C# hyperlink can be launched as a Process, and .NET with Windows will take care of applying it to the default browser.

In a single C# line:

System.Diagnostic.Process.Start("http://www.vcskicks.com/");

One thing to ensure is that the URL is encoded to avoid strange bugs. And once more, the great part is you don't need a LinkLabel necessary to launch the C# hyperlink, the code can be run anywhere in the application...

Back to C# Article List