It took me a while to find this, but above was an answer mixed with several other pages.
Here's how to hide the dropdown from the grid based on the value in another. The ToCheck value must be in the cell before the one that contains the drop-down list that you want to hide.
Private Sub dgv_CellPainting(ByVal sender As Object, ByVal e As DataGridViewCellPaintingEventArgs) Handles dgv.CellPainting 'Pages Grid needs to be edited when rendering If (e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0) Then Dim valueToCheck = dgv.Rows(e.RowIndex).Cells(2).Value If (valueToCheck <> "True") Then Dim thisCol = DirectCast(dgv.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell) thisCol.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing e.PaintBackground(e.ClipBounds, False) e.Handled = True End If End If End Sub
Marshalsea
source share