-- 作者:utcxray
-- 发布时间:2015/1/10 14:47:00
--
参考帮助中的下列代码,没成功 If e.DataCol.Name = "型号"
Then \'如果内容发生变动的是品名列
If e.NewValue Is Nothing Then \'如果新值是空白,也就是品名列的内容为空
e.DataRow("成本")
= Nothing \'那么清空此行单价列的内容
Else
Dim dr As DataRow
\'否则在产品表查找同名的产品行,将找到的行赋值给变量dr
dr = DataTables("采购明细").SQLFind("[型号] =
\'" & e.NewValue & "\'")
If dr IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("成本")
= dr("单价")
End If
End If
End If
. 如果列名不同,或者只需复制部分列,可以参考下面的代码:
If e.DataCol.Name = "逻辑列名" AndAlso e.DataRow("逻辑列名") = True Then
Dim nma() As String = {"A1","A2","A3","A4"} \'A表数据来源列
Dim nmb() As String = {"B1","B2","B3","B4"} \'B表数据接收列
Dim dr As DataRow =
DataTables("表B").AddNew
For i
As Integer =
0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
End If
|