Select Case e.DataCol.Name Case "还款_已还金额" Dim has As Double = IIF(e.newValue=Nothing,0,e.newValue) Dim all As Double = IIF(e.DataRow.Isnull("借款_总金额"),0,e.DataRow("借款_总金额") ) If has > all Then e.Cancel = True MessageBox.Show("还款大于借款","提示",MessageBoxButtons.OK) End If Case "借款_总金额" Dim all As Double = IIF(e.newValue=Nothing,0,e.newValue) Dim has As Double = IIF(e.DataRow.Isnull("还款_已还金额"),0,e.DataRow("还款_已还金额") ) If has > all Then e.Cancel = True MessageBox.Show("还款大于借款","提示",MessageBoxButtons.OK) End If End Select
|