Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I have a winform project , I have initialized a notifyicon with tooltip while logging in using a login form, then the user navigates to form1 or form2 what ever, but I want to create a function to check when database is updated for any new message in inbox to notify them.

1 - Where can I include my function even I am in any form the notification will appear?

2 - How can I check automatically if database is updated?

3 - Or how to use a function with timer to check and update the notify tooltip?


Example I logged in then I am now in form1, but the function is not in this form. Will the notify tooltip work? Where should I call it or initialize this function?

regards...
Posted
Updated 12-Dec-10 1:47am
v4

 
Share this answer
 
Comments
Tamer Hatoum 12-Dec-10 10:08am    
thank you for the links, but that is not my question , I know how to create the notify tooltip.. but I mean I load it when the login form loads , and then I close the login form and I am now for example in form2 then when a new msg updated in inbox database so I want to be notified... how can I do it???
I solved my issue by timer...

I have created a timer in the login form which intialize the notfiy then it calls the function every 10 secs and check in database....

C#
public static System.Timers.Timer aTimer;
       public int cntibx = 0;

then on login button clicked
C#
// login Start
        private void button1_Click(object sender, EventArgs e)
        {

MIDL
// Create a timer with a three second interval.
                     aTimer = new System.Timers.Timer(3000);

                     // Hook up the Elapsed event for the timer.
                     aTimer.Elapsed += new ElapsedEventHandler(Testtimer);

                     // Set the Interval to 2 seconds (2000 milliseconds).
                     aTimer.Interval = 10000;
                     aTimer.Enabled = true;
                     aTimer.Start();
}


then the Testtimer function for doing the stuff and show notifyicon

C#
public void Testtimer(object source, ElapsedEventArgs e)
       {
           int cnt= CountProcc();
           if (cnt > cntibx)
           {
               cntibx = cnt;
               QN.ShowBalloonTip(0, "QN Archive ", "inbox : " + cntibx, System.Windows.Forms.ToolTipIcon.Info);

           }
       }



Regards....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900