473,796 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding MDI forms

I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.
Jun 24 '06 #1
11 2965
Kevin,

I try to avoid the my namespace, it is mainly created for VB6 developers,
while there were already good solutions, which are in my opinion less
confusing when you want to use OOP. (In some cases the my namespace has
handy features so don't understand me wrong).

In your parent you can use the mdichildren instead of that openforms

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

This msdn page is in my idea confusing. It has to be me.mdichildren or just
mdichildren

There are more properties around the MDI form which are easy for you with
what you are busy,

I hope this helps,

Cor
"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:2h******** *************** *********@4ax.c om...
I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.

Jun 24 '06 #2
I tried that too. The only problem is, I can't seem to open a
MDIChild form modally. I have to make them non-child forms to open
them modally, so they don't end up in the MDIChildren collection.
On Sat, 24 Jun 2006 07:16:02 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote:
Kevin,

I try to avoid the my namespace, it is mainly created for VB6 developers,
while there were already good solutions, which are in my opinion less
confusing when you want to use OOP. (In some cases the my namespace has
handy features so don't understand me wrong).

In your parent you can use the mdichildren instead of that openforms

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

This msdn page is in my idea confusing. It has to be me.mdichildren or just
mdichildren

There are more properties around the MDI form which are easy for you with
what you are busy,

I hope this helps,

Cor
"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:2h******* *************** **********@4ax. com...
I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.

Jun 24 '06 #3
you can't make a child form a modal form, its impossible... modal has to
have top level access and all parents behind it lose access at that time
(they get locked out of gaining focus) this is impossible to do when it is a
child of a MDI form inside a MDI window..
"Kevin" <ke****@cfl.rr. com> wrote in message
news:7u******** *************** *********@4ax.c om...
I tried that too. The only problem is, I can't seem to open a
MDIChild form modally. I have to make them non-child forms to open
them modally, so they don't end up in the MDIChildren collection.
On Sat, 24 Jun 2006 07:16:02 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote:
Kevin,

I try to avoid the my namespace, it is mainly created for VB6 developers,
while there were already good solutions, which are in my opinion less
confusing when you want to use OOP. (In some cases the my namespace has
handy features so don't understand me wrong).

In your parent you can use the mdichildren instead of that openforms

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

This msdn page is in my idea confusing. It has to be me.mdichildren or
just
mdichildren

There are more properties around the MDI form which are easy for you with
what you are busy,

I hope this helps,

Cor
"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:2h****** *************** ***********@4ax .com...
I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.

Jun 24 '06 #4
I bet you anything your exception is because you are modifying the
collection and the enumeration is changing

for each depends on the enumeration it stay constant... you cant change it
during the loop... so when you hide a form its probably removing it from the
enumeration of open forms and its like oh look i change cant keep going...
this also applies to looping through other collection enumerations like list
box items and such and like removing an item from the list while you are
going through it... the only way around it is drop the for each and use a
for i as integer = 0 to my.application. openforms.count -1 type of loop
this will not be affected by the collection changing like for each is
Jun 24 '06 #5
I started to do the For Next loop, but I'm not real sure how to call
each form.
On Sat, 24 Jun 2006 15:17:50 -0400, "Smokey Grindle"
<no****@dontspa mme.com> wrote:
I bet you anything your exception is because you are modifying the
collection and the enumeration is changing

for each depends on the enumeration it stay constant... you cant change it
during the loop... so when you hide a form its probably removing it from the
enumeration of open forms and its like oh look i change cant keep going...
this also applies to looping through other collection enumerations like list
box items and such and like removing an item from the list while you are
going through it... the only way around it is drop the for each and use a
for i as integer = 0 to my.application. openforms.count -1 type of loop
this will not be affected by the collection changing like for each is

Jun 25 '06 #6
Than if you don't have MDI forms, why is your question about that?

Cor

"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:7u******** *************** *********@4ax.c om...
I tried that too. The only problem is, I can't seem to open a
MDIChild form modally. I have to make them non-child forms to open
them modally, so they don't end up in the MDIChildren collection.
On Sat, 24 Jun 2006 07:16:02 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote:
Kevin,

I try to avoid the my namespace, it is mainly created for VB6 developers,
while there were already good solutions, which are in my opinion less
confusing when you want to use OOP. (In some cases the my namespace has
handy features so don't understand me wrong).

In your parent you can use the mdichildren instead of that openforms

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

This msdn page is in my idea confusing. It has to be me.mdichildren or
just
mdichildren

There are more properties around the MDI form which are easy for you with
what you are busy,

I hope this helps,

Cor
"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:2h****** *************** ***********@4ax .com...
I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.

Jun 25 '06 #7
On Sun, 25 Jun 2006 00:17:33 GMT, Kevin <ke****@cfl.rr. com> wrote:
I started to do the For Next loop, but I'm not real sure how to call
each form.

For Each ChildForm As Form In Me.MdiChildren
ChildForm.Visib le = False
Next
Gene


On Sat, 24 Jun 2006 15:17:50 -0400, "Smokey Grindle"
<no****@dontsp amme.com> wrote:
I bet you anything your exception is because you are modifying the
collection and the enumeration is changing

for each depends on the enumeration it stay constant... you cant change it
during the loop... so when you hide a form its probably removing it from the
enumeration of open forms and its like oh look i change cant keep going...
this also applies to looping through other collection enumerations like list
box items and such and like removing an item from the list while you are
going through it... the only way around it is drop the for each and use a
for i as integer = 0 to my.application. openforms.count -1 type of loop
this will not be affected by the collection changing like for each is

Jun 25 '06 #8
you can access them by index...

for i as integer = 0 to my.application. openforms.count -1
my.application. openforms(i).vi sible = false
next

"Kevin" <ke****@cfl.rr. com> wrote in message
news:lf******** *************** *********@4ax.c om...
I started to do the For Next loop, but I'm not real sure how to call
each form.
On Sat, 24 Jun 2006 15:17:50 -0400, "Smokey Grindle"
<no****@dontspa mme.com> wrote:
I bet you anything your exception is because you are modifying the
collection and the enumeration is changing

for each depends on the enumeration it stay constant... you cant change it
during the loop... so when you hide a form its probably removing it from
the
enumeration of open forms and its like oh look i change cant keep going...
this also applies to looping through other collection enumerations like
list
box items and such and like removing an item from the list while you are
going through it... the only way around it is drop the for each and use a
for i as integer = 0 to my.application. openforms.count -1 type of loop
this will not be affected by the collection changing like for each is

Jun 25 '06 #9
I have MDI forms , but occasionally I have to show a form modally. NOT
EVERY form can be a MDI Child form!
On Sun, 25 Jun 2006 07:16:10 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote:
Than if you don't have MDI forms, why is your question about that?

Cor

"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:7u******* *************** **********@4ax. com...
I tried that too. The only problem is, I can't seem to open a
MDIChild form modally. I have to make them non-child forms to open
them modally, so they don't end up in the MDIChildren collection.
On Sat, 24 Jun 2006 07:16:02 +0200, "Cor Ligthert [MVP]"
<no************ @planet.nl> wrote:
Kevin,

I try to avoid the my namespace, it is mainly created for VB6 developers,
while there were already good solutions, which are in my opinion less
confusing when you want to use OOP. (In some cases the my namespace has
handy features so don't understand me wrong).

In your parent you can use the mdichildren instead of that openforms

http://msdn2.microsoft.com/en-us/lib...ichildren.aspx

This msdn page is in my idea confusing. It has to be me.mdichildren or
just
mdichildre n

There are more properties around the MDI form which are easy for you with
what you are busy,

I hope this helps,

Cor
"Kevin" <ke****@cfl.rr. com> schreef in bericht
news:2h***** *************** ************@4a x.com...
I've got a timer on my MDI parent form. If there's no mouse movement
for a set number of minutes, the Visible property of all open forms is
set to False and the Log On form is displayed. I could do it in VB6.

In VB2005 I can get a list of all the open forms, but I get an error
after hiding the first one.

This is what I'm trying to use:

For Each m In My.Application. OpenForms
If m.Name <> "frmMain" Then
m.Visible = False
End If
Next m

It won't list all the open forms if one of the child forms is showing
another modal form. And again, once it hides the first form, it bombs
out--something about my OpenForms collection changing.

Jun 25 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5192
by: web_design | last post by:
I put this together from some other scripts I am using on a site. I'm trying to make a better email hiding script. It isn't working. Also, it causes Internet Explorer 6 SP2 to block the script as "active content". :( The idea is that if the user doesn't have JavaScript enabled, they will see an image of the email address (that can't be read by email harvesting programs). If JavaScript is enabled, the image will be hidden and the...
17
2921
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that when the Poodle is upcast to the Dog (in its wildest dreams) it then says "bow wow" where the bernard always says "woof" (see code). Basically, it appears that I'm hiding the poodle's speak method from everything except the poodle. Why would I...
22
2195
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of Administrator, one would be prevented from deleting a ticket not created by oneself. However, it did occur...
4
3604
by: Tom | last post by:
I have a DLL that has a couple of class objects, and a few forms. When someone uses my DLL (i.e. puts a reference to it in their program), I want them to see the class objects that are public, but I -DON'T- want them to see the forms (via intellisense). They should only be able to access the forms by calling routines in the class libraries which then display the forms. What do I need to do to get this to occur? Declare each forms...
5
3997
by: Ivan | last post by:
I am used to VB6 and am not sure how to do this in Vstudio .NET. I have a main form which calls other forms. I want to disable that main form while other ones are called. I tried hiding it and creating a new instance of the main form when returning to it but than my application is just creating more forms. How do I hide the main form and return back to it when exiting another form?
1
2153
by: c.verma | last post by:
I am not able to hide a href element using javascript. Here is my code written on aspx page. On the click of "OK" button, I want to hide href element. But I am getting message: Object required. Any ideas? <asp:textbox id="txtWait" style="DISPLAY: none" runat="server" Width="326px" BorderStyle="None" BorderColor="whitesmoke" ForeColor="Red" ReadOnly="true" Font-Bold="True">Please wait while we process your information...</asp:textbox><br>
7
1761
by: Steve954 | last post by:
I recently installed and started using VS2005 on a Windows XP Pro machine. When creating a new windows forms project I find that I am unable to hide any forms using the me.hide() or me.visible = False methods. As far as I can tell these methods are available and should work in VB2005. Any help and advise would be great as this is causing be a number of problems of two new projects I am working on. Many Thanks
14
2430
by: Dom | last post by:
Hi all I'm developing a control, and I need to hide some properties to the user. For example, suppose I need Text property to be completely inacessible (from a Form/Code that is into another project/assembly). I tried with attributes: <Browsable(False), _ EditorBrowsable(EditorBrowsableState.Never), _ RefreshProperties(RefreshProperties.Repaint), _
0
903
by: Jordi Rico | last post by:
Hi, I have an MDI Form which shows maximized mdi chil forms. I don't want these forms to show its own icon, and I am not able to hide it... Is there any way of hiding my forms icons??? Thanks
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.