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

Forms

P: n/a
ats
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
Oct 23 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Oct 23, 1:39 am, "ats@jbex" <al...@allenjones.NOSPAM.co.PLEASE.uk>
wrote:
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.

--
Tom Shelton

Oct 23 '07 #2

P: n/a
"ats@jbex" <al***@allenjones.NOSPAM.co.PLEASE.uk>'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

--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
Oct 23 '07 #3

P: n/a
ats
On Tue, 23 Oct 2007 09:16:33 +0100, Jan Hyde (VB MVP) wrote:
"ats@jbex" <al***@allenjones.NOSPAM.co.PLEASE.uk>'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
Thanks to you both for the information. It is much appreciated :-)
--
ats@jbex
Oct 23 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.