is there a better way...

  • Thread starter Thread starter Tym
  • Start date Start date
T

Tym

...of waiting for another form to close before continuning

frmDialog.Show()
While frmDialog.Visible = True
System.Windows.Forms.Application.DoEvents()
End While
 
If its a modal form, you should instead use ShowDialog() to show the form.
Then check the return value of this method to determine whether Ok or Cancel
or any of other applicable buttons was pressed. You can get rid of the while
loop then. For instance, if you need to test for the Ok button, you would do
something like this:

If frmDialog.ShowDialog() = DialogResult.OK Then
' do something..
End If


hope that helps..
Imran.
 
Tym said:
..of waiting for another form to close before continuning

frmDialog.Show()
While frmDialog.Visible = True
System.Windows.Forms.Application.DoEvents()
End While

\\\
frmDialog.ShowDialog()
///
 
Richard,

Why what Herfried shows does exactly the same as in the code from Tym, with
the difference that the computer is not for almost 90% busy with the
doevents.

Cor

"Richard Myers"
...
 
Tym.
Thanks - much more helpful than Cor's comments... :-)

It is Ok I stop answering questions from you completly.

It seems that when it is not too MVP's you seem to give no replys at all.

Success,

Cor
 

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

Back
Top