If e.DataCol.Name = "型号" Then Dim dr As DataRow dr = e.DataTable.Find("型号 = '" & e.NewValue & "'") If dr IsNot Nothing Then Dim result As DialogResult = MessageBox.Show("此型号已录入,是否继续录入", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If result = DialogResult.No Then e.Cancel = True End If End If End If