Desktop is showing when form is closed-VBForums
Results 1 to 2 of 2

Thread: Desktop is showing when form is closed

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2012
    Posts
    249

    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

    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
    Last edited by jdy0803; Feb 12th, 2013 at 04:44 PM.

  2. #2
    Loquacious User Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    24,303

    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.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.