Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    APIs
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> C# >> LinkLabel Control in C#.Net
LinkLabel Control in C#.Net
LinkLabel Control in C#.Net


by Chris S on 1/24/2011 5:30:03 PM

Views: 4031       Comments: 0

LinkLabel Control in C#.Net

LinkLabel is a class which is derived from label class so it has all the functions of label class. But LinkLabel  control  works as a hyperlink and its appearance is also as hyperlink.

Drag and drop LinkLabel control from toolbox on the window Form.

LinkLabel Control in C#.Net

Code:

Write code on LinkClicked event

LinkLabel Control in C#.Net

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

{

//after visiting site LinkLabel color changed which will indicate  that you have visited this site

        linkLabel1.LinkVisited = true;

        System.Diagnostics.Process.Start("www.mindstick.com");

        //using the start method of system.diagnostics.process class

        //process class gives access to local and remote processes

 }

System.Diagnostics.Process.Start

The System.Diagnostics namespace exposes a Process class that you can use to launch external programs.You can launch a new process with the shared Process.Start method, passing it either the name of an executable file or a filename with an extension associated with an executable application.

Run the project

LinkLabel Control in C#.Net

When you click on the link Go toGoogle then LinkClicked event will fire and redirected to the www.google.com.

LinkLabel Control in C#.Net

LinkLabel Properties:

LinkBehaviour:    Behaviour of link can be changed through LinkBehaviour properties LinkLabel.

Example:

private void Form9_Load(object sender, EventArgs e)

{

  //disable underline

  linkLabel1.LinkBehavior = LinkBehavior.NeverUnderline;

}

LinkLabel Control in C#.Net

Now when application run then Underline will not show in LinkLabel.

ForeColor:  set the foreground color of the LinkLabel control.

BackColor:  set the background color of LinkLabel control.

Example:

private void Form9_Load(object sender, EventArgs e)

{

        //change BackColor of LinkLabel

        linkLabel1.BackColor = Color.CadetBlue;

}

LinkLabel Control in C#.Net

 

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Chris SRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 2694
Advertisement
MindStick DataConver
Advertise with Us
  
Copyright © 2013MindStick. All Rights Reserved.