【发布时间】:2013-03-17 21:34:00
【问题描述】:
我有一个程序使用包含 7 列的 datagridview。其中一列是一个超链接,它将从指定位置加载文件。我使用“cellcontentclick”事件打开文件。我的问题是,当我单击该行中的任何其他单元格时,它仍会执行 cellcontentclick。仅当单击时执行该特定列时,如何才能做到这一点?
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
try
{
string sourcePath = @"SPECIFIED PATH";
Process.Start(sourcePath + dataGridView1.Rows[e.RowIndex].Cells[5].Value);
}
catch (SqlException e)
{
MessageBox.Show("Error occured: " + e);
}
}
【问题讨论】:
标签: c# datagridview hyperlink