Closing messagebox?

G

Graeme

2nd posting ...

How do I force messagebox to close after OK button click? I don't explicity
'close' the dialog. Maybe
I should somehow? See code below, where I do some database work after OK
click ...in this case, msgbox is displayed for several minutes. Is there a
DoEvents or something which can be applied?

Thanks for your help!
Graeme


myResult = MessageBox.Show("Are you sure you want to update ODRC lives and
costs? This process updates the assets database table and can take several
minutes.", "Update ODRC?", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1)
If myResult = DialogResult.No Then gbxODRCRequirements.Visible = False :
Exit Sub

If myAssetType = "Equipment" Then

RecalcODRC()

ElseIf myAssetType = "Structures" Then

RecalcPoleODRC()

End If

....and so on.
 
H

Herfried K. Wagner [MVP]

* "Graeme said:
How do I force messagebox to close after OK button click? I don't explicity
'close' the dialog. Maybe
I should somehow? See code below, where I do some database work after OK
click ...in this case, msgbox is displayed for several minutes. Is there a
DoEvents or something which can be applied?

The messagebox will block the whole application and will be closed when
the user presses a button.
 
G

Graeme

OK ... maybe I worded my problem wrong. It may close immediately, but it is
displayed for a number of minutes. How to overcome please?
 
J

Javier Campos

Graeme said:
OK ... maybe I worded my problem wrong. It may close immediately, but it is
displayed for a number of minutes. How to overcome please?

Application.DoEvents() right before the 'If' should close the messagebox and
do any painting operations (including removing the messagebox) before your
long operation begins.

Hope this helps,

Javier Campos
 
G

Graeme

Thanks Javier. I'll have a go.
Javier Campos said:
Application.DoEvents() right before the 'If' should close the messagebox and
do any painting operations (including removing the messagebox) before your
long operation begins.

Hope this helps,

Javier Campos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top