我的程序会在产品即将过期并达到其临界水平时通过MsgBox
通知。如果出现很多MsgBox
,那就太烦人了。我只是想在Panel中列出一些通知消息,比如Facebook的通知。
这是我的代码:
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles btnStockNotif.Click
timerStockNotif.Stop()
Dim critical, stocks, medName, unit As String
Try
SQL = "SELECT critical_level, medicine_name, stocks_on_hand, unit FROM medicine_info"
ConnDB()
cmd = New MySqlCommand(SQL, conn)
dr = cmd.ExecuteReader()
While dr.Read
critical = dr("critical_level")
stocks = dr("stocks_on_hand")
medName = dr("medicine_name")
unit = dr("Unit")
If stocks <= critical Then
MsgBox("The product " & medName & " " & unit & " has only " & stocks & " stocks left. Please call your supplier to order more " & medName & " " & unit & ".", MsgBoxStyle.Exclamation, "Product at critical level")
If MsgBoxResult.Ok Then
btnStockNotif.Visible = False
End If
End If
End While
Catch ex As Exception
MsgBox(ex.ToString)
Finally
cmd.Dispose()
conn.Close()
End Try
End Sub