473,806 Members | 2,253 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
11 2968
How can I reference them by name? If I put the names of all open forms
into a string array, how can I go back through the list and change
their Visible property back to True?
On Sun, 25 Jun 2006 11:18:54 -0400, "Smokey Grindle"
<no****@dontspa mme.com> wrote:
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. com...
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
enumeratio n 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 #11
Hello, Kevin,

I suggest that you try something like the following. Sorry I haven't
tested this because I'm not currently using 2005. :-( Worse, I don't
seem to be able to open MSDN just now to check whether or not OpenForms
has an array nature or a collection nature. If the latter, try changing
my use of "Length" to "Count".

Dim IndexOfNonMainF orm As Integer = 0
While Me.MdiChildren. Length > 1
Dim m As Form = MdiChildren(Ind exOfNonMainForm )
If (m.Name = "frmMain") Then
IndexOfNonMainF orm = 1
m = MdiChildren(Ind exOfNonMainForm )
End If
m.Visible = False
End While

Cheers,
Randy
Kevin wrote:
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 26 '06 #12

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

Similar topics

4
5193
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
2923
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
2198
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
3605
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
3998
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
2155
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
1763
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
2432
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
905
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
9718
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
9596
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
10617
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
10109
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
9186
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...
0
6876
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();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
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.