开发者

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?


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: user@domain.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜