老师,需求:只有第1列有变动且变动结果为IsNot Nothing,才复制第2列的数据 目前:第1列有变动就复制第2列的数据(第1列内容删除且第2列因之前代码执行后有数据A的话,会导致第1列所有行内容为IsNot Nothing的第2列内容自动复制为A
代码如下
Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
Case
"本单日期"
If dr.IsNull("厂家单号") Then
e.DataRow("厂家日期") = e.DataRow("本单日期")
End If
Case
"供应商名称"
Dim pr As DataRow = e.DataRow.GetParentRow("应付科目")
If pr IsNot Nothing Then
e.DataRow("供应商") = pr("龙域名称")
End If
If dr.IsNull("供应商") Then
e.DataRow("供应商")
= e.DataRow("供应商名称")
End If
Case "厂家单号"
Dim pr1
As DataRow =
Nothing
For Each
r As DataRow In DataTables("应付单据复核").Select("",
"厂家单号")
If r("厂家单号") IsNot
Nothing AndAlso
pr1 IsNot Nothing AndAlso pr1("厂家单号")
= r("厂家单号") Then
r("备注")
= pr1("备注")
End If
pr1 = r
Next
End Select
[此贴子已经被作者于2019/5/6 19:12:06编辑过]