本文介绍了Datagridview复选框列的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带复选框列的datagridview.我想在用户通过单击更改复选框时立即捕获其值.我尝试了几个事件(CellValueChanged,CellClicked,CurrentCellDirtyStateChanged等),但没有任何效果. 我的代码是
Hi, I have a datagridview with a checkbox column. I want to capture the value of checkbox immediately when user changes it by clicking. I tried several events (CellValueChanged, CellClicked,CurrentCellDirtyStateChanged etc.) but nothing worked. My code is
If dgvIDsTBC.CurrentRow.Cells(2).Value = True Then MsgBox("True") End If请告知为此使用什么事件. 谢谢 Furqan
Please advise what event to use for this. Thanks Furqan
推荐答案使用CellContentClick Use CellContentClick Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick MsgBox(DirectCast(sender, Forms.DataGridView).Rows(e.RowIndex).Cells(e.ColumnIndex).EditedFormattedValue) End Sub
更多推荐
Datagridview复选框列的值
发布评论