Foxtable(狐表)用户栏目专家坐堂 → [讨论]如何判断负数?(就是限制单元格输入负数)


  共有2219人关注过本帖树形打印复制链接

主题:[讨论]如何判断负数?(就是限制单元格输入负数)

帅哥哟,离线,有人找我吗?
pengdx123
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:136 积分:915 威望:0 精华:0 注册:2016/3/8 17:16:00
[讨论]如何判断负数?(就是限制单元格输入负数)  发帖心情 Post By: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
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:136 积分:915 威望:0 精华:0 注册:2016/3/8 17:16:00
  发帖心情 Post By:2016/9/7 17:04:00 [只看该作者]

在DataColChanging里写的

 回到顶部
帅哥哟,离线,有人找我吗?
pengdx123
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:136 积分:915 威望:0 精华:0 注册:2016/3/8 17:16:00
  发帖心情 Post By:2016/9/7 17:13:00 [只看该作者]

图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
pengdx123
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:136 积分:915 威望:0 精华:0 注册:2016/3/8 17:16:00
  发帖心情 Post By:2016/9/7 17:23:00 [只看该作者]

再顶!!!

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109720 积分:558310 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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

 回到顶部