Fire event when float > 80

I might be overthinking this and just need another brain to look at this, but here's my situation.

 private void timer1_Tick(object sender, EventArgs e) //10 milisecond intervals { string pos = axVLCPlugin21.input.Position.ToString(); float pos1 = float.Parse(pos); float a = pos1 * 100; label1.Text = a.ToString() + "% completed"; if (a > 80) { MessageBox.Show("80 has been passed"); } } 

I have a video (VLC) player that plays a video, while a Timer_tick event updates a label (label1) of how much the video has been watched.

Once, it hits 80 or higher, I want it to show a message box saying 80 has been passed.

However, I only want it to say the message once. But because it's in the Timer_tick event, it gets fired continuously once it passes 80.

What would be a better way to approach this, so the MessageBox is only fired once after passing 80?

by grecoman8 via /r/csharp

Leave a Reply