Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

VS 2010 [RESOLVED] Problem with closing form

$
0
0
Hi everyone, I got a simple problem but it's getting the best of me.
I use this to show the Reports form, From the Projects form.

Code:

Public Reports As Reports
Code:

Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click

        If Reports Is Nothing Then
            Reports = New Reports
        End If

        Reports.Show()

    End Sub

And this to close the Reports form.

Code:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Me.Close()

    End Sub

But if I try to open Reports again from the Projects form it will not show.

So I put.

Code:

me = Nothing
after Reports.show()'''' This will work however if I have Reports open and click on Button4(see above) then 2 Report forms show. and so on.

So does Me.Close not dispose of the Reports form? Cause when I debug, after I close Reports, in Projects, Reports in set to Reports.

So how do I open then close a form properly?

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>