I have a binded DataGridView where depending on some BoundItem property value that line will be read only. What is the best way to implement this? Thanks
A:
in the rowenter event, set the readonly property of the row accordingly
private sub MyView_RowEnter(...) handles MyView.RowEnter
MyView.Rows(e.Rowindex).ReadOnly = (condition)
end sub
GalleySlave
2008-11-07 10:10:46
I thought that I should do this on some binding event
2008-11-07 10:11:41
+1
A:
Try The event CellBeginEdit
Private Sub Dgv_CellBeginEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles Dgv.CellBeginEdit
If YourCondition(BoundItem.Property) then e.cancel = true
End Sub
This makes the cell readOnly depending on your condition.
x77
2010-07-04 22:50:19