以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  if语句的逻辑关系  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=141958)

--  作者:lfz123
--  发布时间:2019/10/15 9:43:00
--  if语句的逻辑关系
我输入东渡 直接执行MessageBox.Show(2) 满足else的时候又没有执行
If e.DataCol.name = "开票单位" Then
    If e.DataRow("开票单位") = Nothing OrElse e.DataRow("开票单位") = "工资表"  Then
        e.DataRow("税率") = Nothing
    ElseIf e.DataRow("开票单位") = "东渡" Then
MessageBox.Show(1)
        e.DataRow("税率") = 0.09
    Else
MessageBox.Show(2)
        e.DataRow("税率") = 0.03
    End If
End If

--  作者:有点蓝
--  发布时间:2019/10/15 10:03:00
--  
代码在什么事件?

If e.DataCol.name = "开票单位" Then
    If e.DataRow.isnull("开票单位") OrElse e.DataRow("开票单位") = "工资表"  Then
        e.DataRow("税率") = Nothing
    ElseIf e.DataRow("开票单位") = "东渡" Then
        MessageBox.Show(1)
        e.DataRow("税率") = 0.09
    Else
        MessageBox.Show(2)
        e.DataRow("税率") = 0.03
    End If
End If

--  作者:lfz123
--  发布时间:2019/10/15 11:07:00
--  回复:(有点蓝)代码在什么事件?If e.DataCol.name ...

在DataColChanged中


--  作者:有点蓝
--  发布时间:2019/10/15 11:51:00
--  
那么代码没有问题,可能输入的数据有空格,回车等符号
--  作者:lfz123
--  发布时间:2019/10/15 14:34:00
--  回复:(有点蓝)那么代码没有问题,可能输入的数据有...
老师,我知道原因了,是字段名错了,应该是开票单位简称,过长给隐藏起来了,又没仔细看,谢谢老师