Private Sub DataGridView1_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating If (e.ColumnIndex = 2) Then Dim cellData = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value If cellData Is Nothing OrElse IsDBNull(cellData) OrElse cellData.ToString = String.Empty Then MessageBox.Show("Cannot Be Empty") e.Cancel = True ElseIf cellData <= 0 Then MessageBox.Show("Negative Numbers and Zero Not Allowed") e.Cancel = True Exit Sub End If End If End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)