By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,643 Members | 1,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,643 IT Pros & Developers. It's quick & easy.

Is form still loaded

P: n/a
I have the following simple piece of code.

How can I test if the form I show is still loaded?

Thanks
Private Sub mnuAnalysisResults_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAnalysisResults.Click
Dim AFormReport As New frmAnalysisResults
AFormReport.Show()
End Sub
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies

P: n/a
Jack,

It is in the non simple properties

If not myform.isdisposed then

http://msdn.microsoft.com/library/de...posedtopic.asp

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
Hi,

I would make AFormReport a form level variable.

Dim AFormReport As New frmAnalysisResults

Private Sub mnuAnalysisResults_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAnalysisResults.Click
If AFormReport is nothing then
' needs to be reloaded
AFormReport = new frmAnalysisResults
End If

AFormReport.Show()
End Sub

Ken
----------------------
"Jack Russell" <ja***@norubbish.tpg.com.au> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I have the following simple piece of code.

How can I test if the form I show is still loaded?

Thanks
Private Sub mnuAnalysisResults_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAnalysisResults.Click
Dim AFormReport As New frmAnalysisResults
AFormReport.Show()
End Sub
Nov 21 '05 #3

P: n/a
Cor Ligthert [MVP] wrote:
Jack,

It is in the non simple properties

If not myform.isdisposed then

http://msdn.microsoft.com/library/de...posedtopic.asp

I hope this helps,

Cor

Cor,
Thanks
This is where I get confused,
I created the form with a local variable
Dim AFormReport As New frmAnalysisResults
AFormReport.Show()
So what do I pass to is disposed.

Jack
Nov 21 '05 #4

P: n/a
Jack,
Dim AFormReport As New frmAnalysisResults
AFormReport.Show()


Now you are sure that the object exist because you created it before the
show as a complete new form.

For what you probably need (the form is than instanced globaly in the class)
see the sample from Ken.

Cor
Nov 21 '05 #5

P: n/a
Cor Ligthert [MVP] wrote:
Jack,

Dim AFormReport As New frmAnalysisResults
AFormReport.Show()

Now you are sure that the object exist because you created it before the
show as a complete new form.

For what you probably need (the form is than instanced globaly in the class)
see the sample from Ken.

Cor

Thanks to you both for your help
Nov 21 '05 #6

P: n/a
Jack,

"Jack Russell" <ja***@norubbish.tpg.com.au> schrieb:
How can I test if the form I show is still loaded?
[...]
Private Sub mnuAnalysisResults_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles mnuAnalysisResults.Click
Dim AFormReport As New frmAnalysisResults
AFormReport.Show()
End Sub


=>

\\\
Private m_ReportForm As ReportForm
..
..
..
If m_ReportForm Is Nothing OrElse m_ReportForm.IsDisposed Then
m_ReportForm = New ReportForm()
m_ReportForm.Show()
Else
m_ReportForm.Activate()
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.