views:

38

answers:

2

I wrote an alarm app with some complex code i dont feel like breaking up right now to use as an example. I have a timer checking every 10 or so minutes about a state online and on certain conditions my app alerts me. On form_load i set the timer to 10mins and when it triggers and the condition is true i call a function with this in it.

        {
            this.WindowState = FormWindowState.Maximized;
            this.TopMost = true;
            this.Activate();
        }

When i start the app i typically minimize it and do whatever. Today i notice it isnt working. On my initial test i call the code after pulling the states and calling the func on form_load which always brought it up but now that i am doing other things and the window has been minimized i notice it did not work. How do i fix this?

+2  A: 

Are you hiding the form? In which case try this.Show() instead.

Neil Barnwell
d'oh, i was. I dont remember coding that.
acidzombie24
A: 

Additionally, form_load runs once (usually). You want form_activated. The form is in memory (loaded) whether or not it's minimized.

And, including a call to the activate event in your form_load event is redundant.

Sarkazein