Closing messagebox?

  • Thread starter Thread starter Graeme
  • Start date Start date
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.
 
* "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.
 
OK ... maybe I worded my problem wrong. It may close immediately, but it is
displayed for a number of minutes. How to overcome please?
 
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
 
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
 
Back
Top