是DATACOL CHANGED事件
本来想让它在
e.oldvalue 有值执行这个代码:
If e.DataCol.name = "样品数量" Or e.DataCol.name = "案子号" And e.oldvalue IsNot Nothing Then
DataTables("样品信息").DeleteFor("样品编号 Like '" & e.DataRow("案子号") & "-" & "%'")
For i As Integer = 1 To e.DataRow("样品数量")
Dim str As String = e.DataRow("案子号") & "-" & i
'Dim fdr As DataRow = DataTables("样品信息").find("样品编号 = '" & str & "'")
'If fdr IsNot Nothing Then
Dim nr As DataRow = DataTables("样品信息").AddNew
nr("样品编号") = str
nr("项目") = e.DataRow("项目")
Next
End If
本来想让它在
e.oldvalue 没有值时执行这个代码
If e.DataCol.name = "样品数量" Or e.DataCol.name = "案子号" And e.oldvalue Is Nothing Then
For i As Integer = 1 To e.DataRow("样品数量")
Dim str As String = e.DataRow("案子号") & "-" & i
'Dim fdr As DataRow = DataTables("样品信息").find("样品编号 = '" & str & "'")
'If fdr IsNot Nothing Then
Dim nr As DataRow = DataTables("样品信息").AddNew
nr("样品编号") = str
Next
End If
但是好像不能根据e.oldvalue 有无值得情况执行样,都是执行的e.oldvalue Is Nothing 时的代码