Datacolchanged事件
'检查子件与父件是否嵌套
Select e.DataCol.name
Case "产品编码","父件编码"
If e.DataRow.IsNull("产品编码") = False AndAlso e.DataRow.IsNull("父件编码") = False Then
Dim pdr As DataRow = e.DataRow
Do While pdr IsNot Nothing
pdr = e.DataTable.Find("父件编码 = '" & pdr("产品编码") & "'")
If pdr IsNot Nothing Then
If pdr("产品编码") = e.DataRow("父件编码") Then
msgbox("嵌套")
e.DataRow("父件编码") = Nothing
End If
End If
Loop
End If
End Select