Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message Box Question 1

Status
Not open for further replies.

shannanl

IS-IT--Management
Apr 24, 2003
1,071
0
0
US
I have a program that checks a database table every minute. If certain criteria is met the program displays a message box alerting the user. Is there a way that I can make the program display only one message box? Each minute, a new one pops up. I would only like one until the person acknowledges it. As it is now if they are away from their monitor for 10 minutes they will have 10 message boxes up.

Thanks,


Shannan
 
I don't think message boxes have that option, but It could easily be done using a form that looks like a message box.
 
Here is an option.

Use a custom form insted of the msgbox. Once you have designed the form(just a small form with a lable and a close button ro something), declare a class variable with a type of your new form (Dim f as MyNewCustomForm).

Then in the sub that creates the message do somthing like this:
If f Is Nothing Then
f = New MyNewCustomForm
f.SomeCustomMethodOrPropertyToSetTheMessage("MyMessage")
f.ShowDialog
f.Dispose()
End If

That should only create a new custom message when there is not already one.

Senior Software Developer
 
Okay, will do. Thanks for the help guys.

Shannan
 
Wait... thinking about this a little more, you might be able to use a message box and a boolean (dimentioned at the class or in a module)

Then:
If bMsgShown = False Then
bMsgShown = True
MsgBox("Your Message...")
bMsgShown = False
End If

Senior Software Developer
 
Yes that would work quite well. I did that and then set the boolean value to true after they acknowledged the message box. I don't know why I did not think of that.

Thanks,

Shannan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top