Link to home
Start Free TrialLog in
Avatar of duta
duta

asked on

VB 2005: How to Make MessageBox Disappear automatically?

Dear Experts:

I wonder whether there is a way to make a  message (MessageBox.Show) to disappear automatically after three seconds of display so that the user don't have to click to close the box.

Thanks a lot!
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

The better solution is to create your own messagebox, but you can also do a walkaround and use send keys to close it. It's not 100% safe because the user can change the focus to another point, but most of the times it will work.
Avatar of duta
duta

ASKER

YOU SAID: to create your own messagebox,

MY QUESTION:  Can you kindly give me a sample code?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A message box is nothing other than a form.
Create a form with a timer control and label. Overload Show() method of the form to get a string. When this method is called create a form assign the string to the label and start timer. On timer event when it reaches 3 minutes close the form
Avatar of duta

ASKER

Thanks a lot for your kind tips.

I am a total novice. It may take a while for me to figure it out probably through
countless trial and errors.

It seems a little daunting task.

If you can kindly offer me a complete code, it will be tremendously appreciated.

But I know it may be too much for you :)

Thanks!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of duta

ASKER

I tried jpaulino's frmMessage.

It worked fine. But there is a little problem.
The form is displayed away from the main form.

Is there a way to make the frmMessage displayed in front of the main form>

Thanks!
have you tried my example?
Avatar of duta

ASKER

emoreau, I tried your tip.
I found one too many text in the MessageBox, which I am afraid may be a little distracting.
I also found that jpailino.s frmMessage was more friendly to custom-make :)

I am a total novice. My observation may be wrong.

Thanks!
>>I found one too many text in the MessageBox

You put what you want. I have created many options as people often want many features but you don't have to use them all!