0

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 Answers1

1

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.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
  • Thank you! Is there any previous Stack Overflow thread or elsewhere that explains how to force the additional thread? – shoopdawhoop574 Apr 07 '23 at 00:26
  • 1
    @shoopdawhoop574, it would be silly to do it that way when you can just use your own form and close it with a `Timer`. It would be especially silly if you have no experience with or understanding of multi-threading. – jmcilhinney Apr 07 '23 at 04:07