仅在第3列上启用单元格单击事件
问题描述:
有谁知道我可以如何启用
datagridview的单元格单击事件仅在第3个
柱子.因此,只有在第三个
单击列?
任何帮助都将得到应用!
我在第三列上有一个删除按钮,
因此它只需在
时删除该行
按钮(第3行)被单击.
(删除行不是问题.多数民众赞成
工作正常)
Hi,
Does anyone know how I canconly enable a
datagridview''s cell click event only on the 3rd
column. So it will only trigger when the 3rd
column is clicked?
Any help would be appriciated!!
I have a remove button on the 3rd column,
so it has to only remove the row when the
button (3rd) row is clicked.
(Its not a problem removing the row. Thats
working fine)
答
如果您使用WinForms DataGridView,则可以使用显示的事件处理程序.
If your using WinForms DataGridView you can use the event handler shown.
private void dataGridView_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.ColumnIndex == 2) //3rd Column
{
.... Do something .....
}
}
这只会查看第3列,而忽略其余部分.
希望能有所帮助.
This will only look at the 3rd column and ignore the rest.
Just a shot hope it helps.