Message Box
Message Box
Message Box
Message Box
Message Box
Message Box Message Box Message Box Message Box Message Box Message Box Message Box Message Box
Message Box Message Box
Message Box
Go Back  Xtreme Visual Basic Talk > > > Message Box


Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2009, 11:18 AM
rickson rickson is offline
Newcomer
 
Join Date: Dec 2008
Posts: 23
Default Message Box


Hi,
Can anyone teach me how to set the time for the message box to close by it own? That mean when the message box pop out, it will automatically closed according to the duration set and continue to the following code..

Thanks.
Reply With Quote
  #2  
Old 02-19-2009, 01:00 PM
BBauer42's Avatar
BBauer42 BBauer42 is offline
Contributor
 
Join Date: Dec 2005
Location: CT, USA
Posts: 448
Default

The easy way of doing this is to create another form, show the form for some time, then close it (rather than using the message box). You can easily duplicate whatever your message box was going to say or do with another form.

Code:
MyForm.Show() MyForm.Refresh() System.Threading.Thread.Sleep(2000) 'show for 2 seconds MyForm.Close()
__________________
www.sportsloon.com
Reply With Quote
  #3  
Old 02-19-2009, 01:07 PM
AtmaWeapon's Avatar
AtmaWeaponMessage Box AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

This is not a built-in functionality of Windows dialog boxes. To implement this, you have to design your own custom dialog that contains the logic.

BBauer42's response is only going to work with non-modal dialog boxes. If you try it with MessageBox.Show() instead of showing a form, you'll find it probably won't close the message box.

Create a form that looks like the dialog box you want, and configure it in such a way that a timer automatically closes it. When you want to display the form, do so by calling the ShowDialog() method, which displays the form modally.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Message Box
Message Box
Message Box Message Box
Message Box
Message Box
Message Box Message Box Message Box Message Box Message Box Message Box Message Box
Message Box
Message Box
 
Message Box
Message Box
 
-->