Timed MessageBox

  • Thread starter Thread starter RP
  • Start date Start date
R

RP

I want to hide the MessageBox after some time automatically. This
MessageBox has only OK button. So I want that it should disappear
after few seconds. I don't want to make a new Form for this.
 
RP,

Your best bet is to use a custom form for this. If you wanted to get
tricky you could look into clicking the OK button with window's API
from a seperate thread, but that might be more trouble than it is
worth.

Adam
 
Adam said:
Your best bet is to use a custom form for this. If you wanted to get
tricky you could look into clicking the OK button with window's API
from a seperate thread, but that might be more trouble than it is
worth.

I agree. It undoubtedly is more trouble than it is worth.

A new form isn't a big deal. And if one imagines that it is, it is
still easier to explicitly write code that creates a plain Form instance
and adds the desired Label (for text) and Button instances to the form.
That would only be a few lines of code, and much more maintainble,
reliable, and easier than trying to force a MessageBox to close prematurely.

Pete
 
Back
Top