MadBoy
MadBoy

Reputation: 11104

How to use hyperlink inside ListView in Winforms C#

I have simple ListView with 3-4 columns. One of the columns have an email address. I would like to be able to press that email address and open up any program which is associated with emails (most likely Outlook).

Is there a way to achieve that without external ListView?

Upvotes: 0

Views: 2298

Answers (1)

TimCodes.NET
TimCodes.NET

Reputation: 4689

Try this

private void listView1_MouseClick(object sender, MouseEventArgs e)
{
  try {
    string mailtoLink = "mailto:"+listView1.SelectedItems[0].SubItems[email_Column].Text;
    System.Diagnostics.Process.Start(mailtoLink);
  } catch(Win32Exception ex) {
    MessageBox.Show("An error has occured: "+ ex.Message);
  }
}

The email is of the format: [email protected]

Upvotes: 1

Related Questions