Private Sub DataGridView1_CellValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating
If DataGridView1.Rows(e.RowIndex).IsNewRow Then Exit Sub If e.ColumnIndex = 4 Then If IsNumeric(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value) = False Then e.Cancel = True MsgBox("请输入数字或小数") End If End If End Sub