“查找户名面积”按钮
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”,很不好看,能否用代码消除。