While loop balloontipclick as condition

226 views Asked by At

I need the following while loop to repeat until the balloontip is clicked. How can I do this?

while(/*Here, I want the loop to end when the Norm.BalloonTipClicked occurs*/)
               {
                   Norm.ShowBalloonTip(10000);
                   System.Threading.Thread.Sleep(10000);
                   `enter code here`
                   System.Threading.Thread.Sleep(60000);
               }

(As you probably realize, 'Norm' refers to the name of the notification icon)

1

There are 1 answers

0
Often Right On BEST ANSWER

Using flags, as suggested by Simon Whitehead, I have been able to solve the problem. By using the below code, everything now works!

 bool for3 = false;
                    for (; ; )
                    {
                        Norm.ShowBalloonTip(10000);
                        System.Threading.Thread.Sleep(10000);
                        Application.DoEvents();
                        if (loopVariable)
                            for3 = true;
                        if (for3) break;
                        System.Threading.Thread.Sleep(60000);

                    }
private static bool loopVariable = false;

  void Norm_BalloonTipClicked(object sender, EventArgs e)
   {
       loopVariable = true;
   }

Thanks to Simon Whitehead for all of his help! It is much appreciated.