If e.DataCol.Name = "入库" AndAlso
e.DataRow("入库") = True
Then \'如果列名是入库且入库为真
Dim cz As DataRow \'在出入库表中查找与所选型号一致的行
cz= DataTables("出入库").Find("[型号] = \'" &
e.Table.Current("型号")
& "\'")
If cz Is Nothing \'没找到就入库
Dim nma() As String = {"项目名称","产品名称","型号","规格","单价","供应商"}
\'采购明细表数据来源列
Dim nmb() As String = {"项目名称","产品名称","型号","规格","单价","供应商"} \'出入库表数据接收列
Dim dr As DataRow = DataTables("出入库").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
Else \'否则提出警告并返回
MessageBox.Show("此产品已在库中!", "警告",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
Return
End If
End If