473,509 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I close a Message Box after so many seconds?

103 New Member
Hello,
I am building a simple application that after contestants enter their information and submit, a Message box appears and confirms their entry. I have an okay button, but if they walk away, I want to timeout and close the message box after lets say 4 seconds. This is a a simple windows form. Can someone help explain what I need to do?
Oct 9 '11 #1
3 14457
michaeldebruin
134 New Member
Maybe try an event but I am not sure. Or try something with a background worker or thread, but I have no idea how to use them in this case. These are only suggestions which you might consider to use.
Oct 9 '11 #2
arvindps
8 New Member
Here is what you do

- create a class

- put a custom method ShowMessage(string title, string message, int timeout)

- place a textbox, button, timer

- place a Form load event
set timer on with interval mentioned in timeout
place message and title

- place a timer_tick event
use Form.Close()

- show it as a dialog using form.ShowDialog()


Now add the class and Call the showmessage method in your application
Oct 10 '11 #3
john garvey
50 New Member
Hi

I use the following. Create a form (with no caption bar if you know how) put your message on the form but don't put a button on the form instead place this code in the class module.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Sub Form_Open(Cancel As Integer)
  5.     ' Set timer for 5 seconds
  6.     Me.TimerInterval = 5000
  7. End Sub
  8.  
  9. Private Sub Form_Timer()
  10.     If Me.TimerInterval <> 0 Then
  11.         Me.TimerInterval = 0
  12.     End If
  13.     DoCmd.Close acForm, Me.Name
  14. End Sub
  15.  
  16.  
Oct 10 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3226
by: Graham | last post by:
What I currently have is a page that opens another browser at 800x600, once that is loaded I would like to close the orginal page down while keeping the page that it has just opened open (To make...
2
5522
by: Jacques Koorts | last post by:
Hi, I've managed to get the parent window close the child window (popup). I do this by the child calling the parent to close it. How can the child close itself without help from parent? So...
4
18086
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
2
10749
by: Daniel | last post by:
TcpClient close() method socket leak when i use TcpClient to open a connection, send data and close the TcpClient with myTcpClientInstance.Close(); it takes 60 seconds for the actual socket on...
1
3227
by: Joshua T. Moore | last post by:
If application A sends a Process.Close message to application B, is there an event handler in application B to handle it? The problem is that application A sends the close message to application...
16
3820
by: Neil Stevens | last post by:
Hi, I would like to implements a message queue much like i used to in vb6 as below:- dim myMsg as MSG while (PeekMessage(myMsg, hWnd, 0, 0)) if myMsg.Msg = WM_QUIT Then End end if
11
2749
by: Roman Werpachowski | last post by:
The following code does not compile: #include <iostream> class close { public: void message(); }; inline void close::message()
14
2063
by: Dan | last post by:
Is this discouraged?: for line in open(filename): <do something with line> That is, should I do this instead?: fileptr = open(filename) for line in fileptr: <do something with line>
4
2524
by: =?Utf-8?B?Um9iZXJ0IFN0eW1h?= | last post by:
Hello All, I am new to these forums and reasonably new to Visual Basic.net. I have been converting a couple of visual basic 6 programs to VB.NET. The programs began failing under windows Vista, so...
1
3195
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7410
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.