Dim dg As DataRow = DataTables("库存材料表").Find("[物料代码] = '" & e.DataRow("物料代码") & "'","_Identify Desc")'获得最后一行
Select Case e.DataCol.name
Case "出库数量"
If dg Is Nothing Then '如果找到了同名的物料代码行,也就是dr不是Nothing
'msgbox("在库存没找到物料")
'e.Cancel = True
e.NewValue = Nothing
Else
If e.newvalue <= 0 Then
e.newValue = Nothing
End If
End If
Dim dms As List(Of String)
dms = DataTables("材料发放明细表").GetValues("物料代码")
For Each dm As String In dms
If dms("记账") = False Then
Dim Sun As Double
Sun = DataTables("材料发放明细表").Compute("Sum(出库数量)", "[物料代码] = ' & dms & '")
If sun >= dg("库存数量") Then
MsgBox("出库量不能大于库存量!")
e.DataRow("出库数量") = Nothing
'e.Cancel = True
End If
End If
Next
End Select
这段代码中 Dim dms As List(Of String)
dms = DataTables("材料发放明细表").GetValues("物料代码")
For Each dm As String In dms
If dms("记账") = False Then 如何修改?