以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]清除“0”值  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=60594)

--  作者:易服
--  发布时间:2014/11/27 16:17:00
--  [求助]清除“0”值

“查找户名面积”按钮

For Each r As Row In Tables("财兑").Rows
    Dim fdr As DataRow = DataTables("兑现").find("乡镇= \'" & r("乡镇") & "\' and 村名= \'" & r("村名") & "\'and 组别= \'" & r("组别") & "\'and 户名 = \'" & r("财政姓名") & "\'")
    If fdr IsNot Nothing Then
        r("户名")=fdr("户名")
        r("生态林_面积")=fdr("生态林_面积")
        r("生态林_不兑面积")=fdr("生态林_不兑面积")
        r("生态林_扣减面积")=fdr("生态林_扣减面积")
        r("经济林_面积")=fdr("经济林_面积")
        r("经济林_不兑面积")=fdr("经济林_不兑面积")
        r("经济林_扣减面积")=fdr("经济林_扣减面积")
    End If
Next

Datacolchanged代码:

If e.DataRow.IsNull("生态林_面积") = False  Then
    e.DataRow("生态林_现补")=e.DataRow("生态林_面积")*20
    e.DataRow("生态林_粮补")=e.DataRow("生态林_面积")*105
    e.DataRow("生态林_应补")=e.DataRow("生态林_现补")+e.DataRow("生态林_粮补")
End If
If e.DataRow.IsNull("生态林_不兑面积") = False  Then
    e.DataRow("生态林_应扣")=e.DataRow("生态林_不兑面积")*20
End If
If e.DataRow.IsNull("生态林_扣减面积") = False  Then
    e.DataRow("生态林_扣减")=e.DataRow("生态林_扣减面积")*105
End If
If e.DataRow.IsNull("生态林_不兑面积") = False OrElse e.DataRow.IsNull("生态林_扣减面积") = False Then
    e.DataRow("生态林_扣补")=e.DataRow("生态林_应扣")+e.DataRow("生态林_扣减")
    e.DataRow("生态林_实现补")=e.DataRow("生态林_现补")-e.DataRow("生态林_应扣")
    e.DataRow("生态林_实粮补")=e.DataRow("生态林_粮补")-e.DataRow("生态林_扣减")
    e.DataRow("生态林_实补")=e.DataRow("生态林_实现补")+e.DataRow("生态林_实粮补")
End If
If e.DataRow.IsNull("经济林_面积") = False  Then
    e.DataRow("经济林_现补")=e.DataRow("经济林_面积")*20
    e.DataRow("经济林_粮补")=e.DataRow("经济林_面积")*105
    e.DataRow("经济林_应补")=e.DataRow("经济林_现补")+e.DataRow("经济林_粮补")
End If
If e.DataRow.IsNull("经济林_不兑面积") = False  Then
    e.DataRow("经济林_应扣")=e.DataRow("经济林_不兑面积")*20
End If
If e.DataRow.IsNull("经济林_扣减面积") = False  Then
    e.DataRow("经济林_扣减")=e.DataRow("经济林_扣减面积")*105
End If
If e.DataRow.IsNull("经济林_不兑面积") = False OrElse e.DataRow.IsNull("经济林_扣减面积") = False Then
    e.DataRow("经济林_扣补")=e.DataRow("经济林_应扣")+e.DataRow("经济林_扣减")
    e.DataRow("经济林_实现补")=e.DataRow("经济林_现补")-e.DataRow("经济林_应扣")
    e.DataRow("经济林_实粮补")=e.DataRow("经济林_粮补")-e.DataRow("经济林_扣减")
    e.DataRow("经济林_实补")=e.DataRow("经济林_实现补")+e.DataRow("经济林_实粮补")
End If
If e.DataRow.IsNull("生态林_实补") = False OrElse e.DataRow.IsNull("经济林_实补") = False Then
    e.DataRow("实补合计")=e.DataRow("生态林_实补")+e.DataRow("经济林_实补")
End If

上述代码执行后表中出现许多“0”,很不好看,能否用代码消除。


--  作者:有点甜
--  发布时间:2014/11/27 16:25:00
--  

 你可以判断然后设置值,比如

 

 e.DataRow("实补合计") = iif(e.DataRow("实补合计") = 0, Nothing, e.DataRow("实补合计"))