Skip to main content

Message Box Timeout?

  • July 22, 2018
  • 1 reply
  • 0 views

 I've been using the message box (Windows) for long time, and once in a while a message box will hold up a process from finishing.  Is there any way to code a timeout on a message box and force the default response after say X number of seconds?

 

The message box variables I'm familiar with are TEXT, TITLE, TYPE, ICON, DEFAULT (response), VALUE 

Thanks,

1 reply

Chris Glazier
Forum|alt.badge.img+2

 I've been using the message box (Windows) for long time, and once in a while a message box will hold up a process from finishing.  Is there any way to code a timeout on a message box and force the default response after say X number of seconds?

 

The message box variables I'm familiar with are TEXT, TITLE, TYPE, ICON, DEFAULT (response), VALUE 

Thanks,

From what I can tell, the standard MessageBox class does not implement a timer functionality. It is recommended that you instead create your own messagebox class using a standard form and then add a timer to it's Load method.

You don't mention what version of the MessageBox class you are using. Is this for WinForms, WPF, native code, etc?

I assumed that you are using WinForms so I created a simple example based on that technology. 

I have attached it to this reply.

Thanks.timedmsgbox.zip