如果我的代码有问题,它也应该出现在代码产品“B”的消息框中,请指导我
谢谢
Dim ResutlQty_Stock = GetStock.Qty_Stock - (detail.Qty - Getprevdetailqty.Qty)
For Each row As DataGridViewRow In DataGridView2.Rows
If ResutlQty_Stock < 0 Then
MessageBox.Show("no available stock for Codeproduct " & CStr(row.Cells("CodeProduct").FormattedValue))
DataGridView2.DataSource = itrservice.GetLoadStocksoutdetailMaster()
Return
End If
Next row
DATAGRIDVIEW 中的结果
您必须使用datagridview的值来计算结果数量
Dim Getprevdetailqty As Integer = 0
For Each row As DataGridViewRow In DataGridView2.Rows
Dim ResutlQty_Stock as Integer = GetStock.Qty_Stock - row.Cells("Qty").Value - Getprevdetailqty
If ResutlQty_Stock < 0 Then
MessageBox.Show("no available stock for Codeproduct " & CStr(row.Cells("CodeProduct").FormattedValue))
DataGridView2.DataSource = itrservice.GetLoadStocksoutdetailMaster()
Return
End If
Getprevdetailqty = Integer.Parse(row.Cells("Qty").Value)
Next row