Timed MessageBox

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.
 
A

Adam Behrle

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
 
P

Peter Duniho

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top