|
-
Jun 27th, 2003, 09:00 AM
#1
Thread Starter
Hyperactive Member
closing messagebox automatically
does anyone know how to close a messagebox automatically?
(without the using clicking it)
-
Jun 27th, 2003, 10:29 AM
#2
Sleep mode
You need some sort of subclassing , but why don't you take the easier path and make your own custom message box with a timer .
-
Jun 27th, 2003, 10:56 AM
#3
Thread Starter
Hyperactive Member
Pirate - thanks for the reply.
I can't use a timer - as
a) I don't know how long to display the messagebox before closing it.
b) I wish to retrospectively incorporate the functionality into the application and so would rather not create my own messagebox class at this point (although I like your thinking).
Effectively what I am doing is recognising that the application hasbn't been used for a given amount of time and displaying a user password screen - however if the user changes I need to close all the children (and other modally displayed) forms.
This is fine I can do this - however I also wish to close down any messageboxes. The problem I have is that when I close the form that requested the messagebox - the messagebox terminates with a "No" (even if it only has a Cancel and Yes button). Mostly this is ok - but It can give unexpected results (such as aborting) depending on the code that follows the messagebox.
-
Jun 30th, 2003, 08:11 PM
#4
Addicted Member
You could have a class with a shared Public flag:
e.g.
Public Class SomeClass
Public Shared ApplicationIsTerminating() as Boolean
End class
and when your application is being closed (or your forms are being closed) set SomeClass.ApplicationIsTerminating = True
When you show a messagbox, use something like the following:
Dim msgboxResult As Windows.Forms.DialogResult = Windows.Forms.MessageBox.Show("Your message", "Your caption", MessageBoxButtons.OKCancel)
If Not SomeClass.ApplicationIsTerminating Then
If msgboxResult = DialogResult.OK Then
' OK processing
ElseIf msgboxResult = DialogResult.Cancel Then
' Cancel processing
End If
Else
'Take a different course of action
End If
-
Jul 1st, 2003, 01:48 AM
#5
hmm lets see... wanna try this?
make a sub that would call the messagebox. Call that sub by declaring a new thread... try terminating the thread and see if the messagebox closes
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 1st, 2003, 02:49 AM
#6
Thread Starter
Hyperactive Member
yes that'll work.
Thanks Mr. Polite. I knew there would be some lateral thinking in there somewhere.
-
Jul 1st, 2003, 08:17 AM
#7
Of course you could always make your own Messagebox form and have full controll over it.
-
Jul 1st, 2003, 01:53 PM
#8
Originally posted by Cander
Of course you could always make your own Messagebox form and have full controll over it.
yeah that;s cool too. Edneeis had an example how to make a form and call it like a messagebox (so it would return the selected value and stuff like that). you may find it if you search
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|