什么事件处理程序最好在VB.net中单击使用数据网格视图?

时间:2022-04-20 05:42:39

I'm having a problem with DataGridView event handler CellContentClick sometimes it does not work.

我有一个DataGridView事件处理程序CellContentClick的问题,有时它不起作用。

here is my code:

这是我的代码:

Private Sub DGV_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DGV.CellContentClick
        ownDataSelected()
    End Sub

Please help me. Thankyou

请帮我。谢谢

1 个解决方案

#1


Use DataGridView.CellClick

This event occurs when any part of a cell is clicked, including borders and padding. It also occurs when the user presses and releases the SPACE key while a button cell or check box cell has focus, and will occur twice for these cell types if the cell is clicked while pressing the SPACE key.

单击单元格的任何部分(包括边框和填充)时会发生此事件。当按钮单元格或复选框单元格具有焦点时,用户按下并释放SPACE键时也会发生这种情况,如果在按下SPACE键的同时单击单元格,则会发生两次这些单元格类型。

DataGridView.CellContentClick triggers only on the text of the cell being click and the blank space not count.

DataGridView.CellContentClick仅触发正在单击的单元格的文本,并且空白空间不计算。

#1


Use DataGridView.CellClick

This event occurs when any part of a cell is clicked, including borders and padding. It also occurs when the user presses and releases the SPACE key while a button cell or check box cell has focus, and will occur twice for these cell types if the cell is clicked while pressing the SPACE key.

单击单元格的任何部分(包括边框和填充)时会发生此事件。当按钮单元格或复选框单元格具有焦点时,用户按下并释放SPACE键时也会发生这种情况,如果在按下SPACE键的同时单击单元格,则会发生两次这些单元格类型。

DataGridView.CellContentClick triggers only on the text of the cell being click and the blank space not count.

DataGridView.CellContentClick仅触发正在单击的单元格的文本,并且空白空间不计算。