Closing a MsgBox after a certain amount of time in VB.NET?

268 Views Asked by At

I need to open a MsgBox that closes itself automatically after a certain amount of milliseconds, regardless of user input.

How can I achieve this?

Using most recent version of VB.NET

Attempted to use a timer but the code executed on timer tick would not run as the MsgBox being open stopped the code from executing

1

There are 1 best solutions below

2
Joel Coehoorn On

MsgBox does not have any support for this. You will not be able to use it, and must create your own message dialog form.

Note: it is possible to force an additional thread, with it's own timer event that fires in a thread not blocked by the message box. From there you can simulate a click event on one of the message box buttons. But the work to do this will be greater and more error prone than making your own dialogue.