Adding hyperlink to win app

I am looking for a way to use hyperlinks in a winforms environment.

I found that he uses System.Web.UI.WebControls

; but when i tried to use it in my program System.Web

it was as far as it would be. So I checked refrences but also not System.Web.UI.WebControls

or something, any sugestions?


source to share

4 answers

If you are developing a WinForms application, you must use an System.Windows.Forms.LinkLabel

assembly-located control System.Windows.Forms

. Controls System.Web.*

are for HTML pages.



You can use the LinkLabel control. Set the LinkLabel text property to show your web link. You can use the LinkClicked event to open the web browser as shown below. Hope this helps you.

     private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)




Why dont you use Link Label



If it is WPF

, you can do something like this:

    <Hyperlink NavigateUri="" RequestNavigate="Hyperlink_RequestNavigate">
        Click here


And in the code:

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
    Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
    e.Handled = true;


It will look like this:




All Articles