仅在第3列上启用单元格单击事件 [英] Enable cell click event only on the 3rd colum

查看:67
本文介绍了仅在第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.


这篇关于仅在第3列上启用单元格单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆