A
Armin Zingler
Hi again, (VB 2003, Framework 1.1)
the behavior of Application.DoEvents depends on the fact whether the form is
shown modeless or modally. Here is a short sample to reproduce:
1. Create a new WindowsApplication and add a Button to the Form
2. Add this code to the Form:
Shared Sub main()
Dim f As New Form1
'f.ShowDialog()
Application.Run(f)
End Sub
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Do
Application.DoEvents()
Loop While Me.IsHandleCreated
End Sub
3. Start and click the button
4. Click the X to close the form
Everything works as expected. Now replace "Application.Run(f)" by
"f.Showdialog()". Start again and click the button. Now, the Form can not be
closed by clicking the X anymore! My short question is: Why?
One bug you'll also see: The first time when you try to click the X, the
Button is actually clicked!
the behavior of Application.DoEvents depends on the fact whether the form is
shown modeless or modally. Here is a short sample to reproduce:
1. Create a new WindowsApplication and add a Button to the Form
2. Add this code to the Form:
Shared Sub main()
Dim f As New Form1
'f.ShowDialog()
Application.Run(f)
End Sub
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Do
Application.DoEvents()
Loop While Me.IsHandleCreated
End Sub
3. Start and click the button
4. Click the X to close the form
Everything works as expected. Now replace "Application.Run(f)" by
"f.Showdialog()". Start again and click the button. Now, the Form can not be
closed by clicking the X anymore! My short question is: Why?
One bug you'll also see: The first time when you try to click the X, the
Button is actually clicked!