I have a datagridview and i basically click a button that goes through all the rows in the table looking at two particular columns: quantity and re-order level.
After every row the code checks to see If the re-order level is greater than the quantity of that particular row.
if the re-order level if greater than the quantity a messagebox appears MsgBox("Need to re-order" & name)
if the re-order level is not greater than the quantity a message box appears MsgBox("Stock is OK")
i am not sure how to go about writing up code so that a message box appears at the very end of the loop displaying all the names of the items that need re-ordering
so it would be along the lines of a msgbox showing the following after the loop is complete
Need to re order the following items:
'list of all the names that need re-ordering
if anyone knows any links that would be useful or any help or advice will be greatly appreciated as am pretty new to this
Private Sub btnCheckStockStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCheckStockStatus.Click
Dim increment As Integer = 0
Dim quantity, reorderlevel As Integer
Dim name As String
MaxRows = KiwicyclesDataSet.Stock_Control.Rows.Count
For increment = 0 To MaxRows - 1
quantity = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Quantity")
reorderlevel = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Re-Order Level")
name = KiwicyclesDataSet.Stock_Control.Rows(increment).Item("Model")
If reorderlevel >= quantity Then
MsgBox("Need to re-order" & name)
Else
MsgBox("Stock is OK")
End If
Next
End Sub