The this approach is prone to failure simply because you are using a timer to show the balloon tip and in the balloon tip closed event you are writing the Visible flag to the database, this is a very bad way to solve your problem, you need to use the timer to update a list or a datatable in memory with all the "issues", you can use the same query and insted of a ExecuteScalar you can use a DataReader or a data adapter , linq is good too :cool: , so your timer only puts the result in memory
The timer should do the following :
1 - Query the Table to find Issues
2 - If issues are found then Put all of them in a (List, DataTable or anything you like )
3 - Call a method that shows a the first issue in the list, this method shouldn't take any parameters
4 - set
tmrPrfrmDBLd.Enabled = False
now on the screen a balloon tip is shown
in the event of closing this balloon tip either by a user action or by time out , you need to do the following :
1 - Delete the issue from the List in memory
2 - Update the table to set visible = false
3 - if there are any more items in list then Call the same method that shows the first Issue in the list
4 - if there are
NO items in list then
tmrPrfrmDBLd.enabled = true
This should save you many many problems in your code you may haven't even discovered yet
Some Notes:
In Balloon-tip closing event you need to ask yourself , what if the user isn't in front of is computer, all the issue notification will be shown and they will disappear after reaching time out, without the user even seeing any of them, your application need to show a different tray icon to indicate that there are issues waiting for the user to be seen, or something of the sort to let the user know when he/she comes back that the application needs their attention.