如何应用vb.net语言获取并修改DataGridView控件中的checkBox

如何应用vb.net语言获取并修改DataGridView控件中的checkBox
我使用DataGridViewCheckBoxColumn在DataGridView中生成了一列的checkBox,想获取被点中checkBox的行,但是一直都没有成功。
所以希望各位高手能帮帮小弟实现这个功能
在此先谢谢了

用 CType(TTS_View1.Rows.Item(i).Cells(j).Controls(1), CheckBox).Checked 判断
If CType(TTS_View1.Rows.Item(i).Cells(j).Controls(1), CheckBox).Checked = True Then

else

end if追问

谢谢你的回答
使用了你提供的方法 ,但是提示controls不是DataGridViewCell里的成员.
我根据我的程序做了一个小小的修改
CType(DataGridView1.Rows(forInt).Cells(0).controls(1), CheckBox).Checked = True

追答

controls(0)试一下

温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-04-17
Private Sub DataGridView1_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

e.RowIndex '就是你单击的行

End Sub
相似回答