以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [讨论]如何判断负数?(就是限制单元格输入负数)  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90203)

--  作者:pengdx123
--  发布时间:2016/9/7 17:03:00
--  [讨论]如何判断负数?(就是限制单元格输入负数)
[讨论]如何判断负数?(就是限制单元格输入负数)
Dim dr As DataRow = e.DataRow
If e.DataCol.Name = "销售数量"
    If e.Newvalue > dr("可用量")
        e.Cancel = True
        MessageBox.Show("不能大于可用量!", "提示", MessageBoxButtons.OK, MessageBoxicon.Error)
        If e.Newvalue < 0
            e.Cancel = True
            MessageBox.Show("哇!请你不要乱填!", "警告", MessageBoxButtons.OK, MessageBoxicon.Error)
        End If
    End If
End If

If e.Newvalue < 0
            e.Cancel = True
            MessageBox.Show("哇!请你不要乱填!", "警告", MessageBoxButtons.OK, MessageBoxicon.Error)
        End If
这个判断不起作用?请各位大神指导一下!图片点击可在新窗口打开查看

--  作者:pengdx123
--  发布时间:2016/9/7 17:04:00
--  
在DataColChanging里写的
--  作者:pengdx123
--  发布时间:2016/9/7 17:13:00
--  
图片点击可在新窗口打开查看
--  作者:pengdx123
--  发布时间:2016/9/7 17:23:00
--  
再顶!!!
--  作者:有点蓝
--  发布时间:2016/9/7 17:52:00
--  
Dim dr As DataRow = e.DataRow
If e.DataCol.Name = "销售数量"
    If e.Newvalue > dr("可用量")
        e.Cancel = True
        MessageBox.Show("不能大于可用量!", "提示", MessageBoxButtons.OK, MessageBoxicon.Error)
    Else
        If e.Newvalue < 0
            e.Cancel = True
            MessageBox.Show("哇!请你不要乱填!", "警告", MessageBoxButtons.OK, MessageBoxicon.Error)
        End If
    End If
End If