使用vb.net取消选中datagrid中的复选框时如何清除datagrid中垂直行的单元格
问题描述:
大家好,我试图解决我的要求.我在winforms中有一个DataGrid.在该数据网格中,一个复选框列和另外几列.当我们取消选中datagrid中的复选框时,清除Same Row的其余列值.
Hi Guys, I tried to solve the my requirement. I have a DataGrid in winforms. in that datagrid one checkbox column and another few columns. When we uncheck the checkbox in datagrid , clear the remaining column values of Same Row.
答
使用datagridview的CurrentCellDirtyStateChange方法
申请条件,
use datagridview''s CurrentCellDirtyStateChange Method
apply condition,
if dgv.currentcell.columnindex=1 then 'use checkbox column's index
if dgv.currentcell.value= false then
dgv.currentrow.cells(2).value="" 'make empty that row's cell
end if
end if
祝您编码愉快!
:)
Happy Coding!
:)