I have a DataGridView in my VB.net Form. I need to make some rows invisible based on a value. As there is not GridviewrowdataBound, I am trying to achieve it as shown in the below Code
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If DataGridView1.Rows(e.RowIndex).Cells("ApplicationIDPKDataGridViewTextBoxColumn").Value <> "1" Then
DataGridView1.Rows(e.RowIndex).Visible = False
End If
End Sub
When I try to do this I am getting the Uncommitted new row cannot be made visible error.
Any thoughts??
Do you allow users to add new items to the DataGridView? If it’s the case, maybe the row used to add a new item cannot be made invisible…