Solved

LinkLabel C#

Posted on 2004-09-14
4
3,020 Views
Last Modified: 2008-01-09
I want to make my link label to open the default browser and move to my website.
I also want to make the link lable use the default mail program to send me an e-mail.
How can I do that?
0
Comment
Question by:drtoto82
  • 2
4 Comments
 
LVL 3

Expert Comment

by:gillgates
ID: 12060214
mailto:youname@youdomain.com?subject=yousubject
0
 
LVL 3

Accepted Solution

by:
gillgates earned 50 total points
ID: 12060870
private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
    {
        // Determine which link was clicked within the LinkLabel.
        this.linkLabel1.Links[linkLabel1.Links.IndexOf(e.Link)].Visited = true;

        // Display the appropriate link based on the value of the
        // LinkData property of the Link object.
        string target = e.Link.LinkData as string;

        // If the value looks like a URL, navigate to it.
        // Otherwise, display it in a message box.
        if(null != target && (target.StartsWith("www") || target.StartsWith("mailto:" )
        {
            System.Diagnostics.Process.Start(target);
        }
        else
        {    
            MessageBox.Show("Item clicked: " + target);
        }
    }
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question