I want to know how can I show notifications in the windows form applications automatically.
my code here:
cn.Open();
SqlCommand cmd = new SqlCommand("select Count(*) from Issue where Return_Date < @Date", cn);
cmd.Parameters.AddWithValue("@Date",DateTime.Now);
int NumberOfOverdue = (int)cmd.ExecuteScalar();
cn.Close();
if (NumberOfOverdue > 0)
{
notifyIcon1.ShowBalloonTip(500, "Library Management System", "There are " + NumberOfOverdue + " overdued book", ToolTipIcon.Warning);
}
The code is located int the Form_Load and obviously it only triggers after I start the program; but I want the notification to show right after the requirement in the if condition is met automatically.