Sub validateDGV(rowindex, columnindex) Dim value As String = DataGridView1.Rows(rowindex).Cells(columnindex).Value.ToString If (columnindex = 1) Then Dim cellData = DataGridView1.Rows(rowindex).Cells(columnindex).Value If cellData Is Nothing OrElse IsDBNull(cellData) OrElse cellData.ToString = String.Empty Then 'Do nothing because this is allowed ElseIf cellData <> 1 Then MessageBox.Show("Value must be 1 or Blank") DataGridView1.Rows(rowindex).Cells(columnindex).Value = String.Empty 'This should be supplying the default value of blank back to my datagridview but its not :( Exit Sub End If End If End Sub
DBNull.Value
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)