Hi,

I have small application which shows an alert in every 45 mins....( to take a break from work :) )..... It is a normal windows form with a timer in it and in every 45 mins I am invoking a message box. I am able to make it work but the problem is that when the application is minimized, the message box is not popping up, it stays with in the parent form (minimized). How can I bring it up to the user focus?

-anoop4real

Hi, In the timer tick code add this

WindowState = FormWindowState.Normal

Hi, In the timer tick code add this

WindowState = FormWindowState.Normal

Thanks for the reply, I have redesigned my application with a toaster window, which worked fine!! , I will try your solution in my old project.

-a4r

Hi, it didn't work as I expected it actually! try this instead it should work and there's no buttons or anything involved.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.TopMost = True
        Timer1.Enabled = False
        MsgBox("Time to take a break! Yay!!", MsgBoxStyle.Information, "Breaktime")
        MsgBox("Click OK when you've had a break!", MsgBoxStyle.Question, "Waiting!")
        Timer1.Enabled = True
        Me.TopMost = False
    End Sub
commented: Thanks for the tip +0

Hi, it didn't work as I expected it actually! try this instead it should work and there's no buttons or anything involved.

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.TopMost = True
        Timer1.Enabled = False
        MsgBox("Time to take a break! Yay!!", MsgBoxStyle.Information, "Breaktime")
        MsgBox("Click OK when you've had a break!", MsgBoxStyle.Question, "Waiting!")
        Timer1.Enabled = True
        Me.TopMost = False
    End Sub

Hey Cool man this was the same kind of application that I was trying to make ie just to tell me to take a break from work after a specific interval :-)............ but anyways now I have a toaster window which will slide up from the right hand side of the screen and tell me to take a break :-).....

-a4r

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.