• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

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!
0
duta
Asked:
duta
  • 4
  • 3
  • 2
  • +1
3 Solutions
 
jpaulinoCommented:
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.
0
 
dutaAuthor Commented:
YOU SAID: to create your own messagebox,

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

Thanks!
0
 
jpaulinoCommented:
Your own messagebox means to create a new form (modal) with a label and buttons to simulate a messagebox.
Here's some examples: http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23565346.html
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
TechTiger007Commented:
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
0
 
dutaAuthor Commented:
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!
0
 
TechTiger007Commented:
duta
check out the link given by jpaulino, I think thats what you need
Below is one from the link
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_23167846.html#a20907999

credit goes to jpaulino
0
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
dutaAuthor Commented:
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!
0
 
Éric MoreauSenior .Net ConsultantCommented:
have you tried my example?
0
 
dutaAuthor Commented:
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!
0
 
Éric MoreauSenior .Net ConsultantCommented:
>>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!
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now