Forms

  • Thread starter Thread starter ats@jbex
  • Start date Start date
A

ats@jbex

In a project I have a Module mMain. At program shutdown I call a procedure
here that will check for any open forms and close them as follows:

Sub CloseAllForms()

Dim f As Form

For Each f In Forms
If f.Name <> "frmMenu.vb" And f.Name <> "frmStatus.vb" Then
f.Close()
End If
Next

End Sub

The problem I have is that I am getting an error message saying that "Name
'Forms' is not declared". What do I need to do to get this code to work?

TIA

--
ats@jbex

I'm not gonna be taken in
They said if I don't join I just can't win
I've heard that story many times before
And every time I threw it out the door

SLF - Wasted Life
 
In a project I have a Module mMain. At program shutdown I call a procedure
here that will check for any open forms and close them as follows:

Sub CloseAllForms()

Dim f As Form

For Each f In Forms
If f.Name <> "frmMenu.vb" And f.Name <> "frmStatus.vb" Then
f.Close()
End If
Next

End Sub

The problem I have is that I am getting an error message saying that "Name
'Forms' is not declared". What do I need to do to get this code to work?

TIA

--
ats@jbex

I'm not gonna be taken in
They said if I don't join I just can't win
I've heard that story many times before
And every time I threw it out the door

SLF - Wasted Life

What version of VB.NET are you using? In 2005, you can use My.Forms.
Before that... There is no such thing.
 
"ats@jbex" <[email protected]>'s wild
thoughts were released on Tue, 23 Oct 2007 07:39:44 GMT
bearing the following fruit:
In a project I have a Module mMain. At program shutdown I call a procedure
here that will check for any open forms and close them as follows:

Sub CloseAllForms()

Dim f As Form

For Each f In Forms
If f.Name <> "frmMenu.vb" And f.Name <> "frmStatus.vb" Then
f.Close()
End If
Next

End Sub

The problem I have is that I am getting an error message saying that "Name
'Forms' is not declared". What do I need to do to get this code to work?

Take a look at My.Application.OpenForms
 
Back
Top