Desktop is showing when form is closed
In the main window of my program, load form and display as modal like following.
Dim frm As New form1
frm.ShowDialog()
When close from form1 by Me.Dispose(), desktop(background) is showing in a flash.
It looks like this.
mainform=>form1=>close form1=>(display desktop)=>mainform
Flickering occurs at (display desktop)
You can see this symptom when you open Windows Explorer on the background.
I don't know why this happens.
Can anybody give me some advice?
Here is my code
Quote:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New form2
frm.ShowDialog(Me)
End Sub
End Class
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
Re: Desktop is showing when form is closed
Are you doing a lot of work in Form1.Activate, or after the ShowDialog call in Form1? Neither seems a likely problem, but if you are doing lots of activity as a result of closing Form2, it may be that Form1 doesn't get to paint very fast. Of course, if the code you showed is really all there is to it, then that isn't the problem in any way.