我的 VB.net 表单中有一个 DataGridView。我需要根据值使某些行不可见。由于没有 GridviewrowdataBound,我正在尝试实现它,如下面的代码所示
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
当我尝试执行此操作时,出现“未提交的新行无法可见”错误。
有什么想法吗?
最佳答案
是否允许用户向 DataGridView 添加新项目?如果是这样的话,也许用于添加新项目的行无法变得不可见......
关于vb.net DataGridView 未提交的新行无法变得不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1763539/