473,472 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

QUESTION ON: For Each Ctl In Me.Controls

Hi friends,

I have the following code in an MDI container (with 3 MDI
forms/children) with a button on the MDI container form.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Ctl As Control
For Each Ctl In Me.Controls
MsgBox(Ctl.Name)
Next
End Sub

Unfortunately when I click the button (Button1), all that is displayed
in the dialog boxes are "" and the name of the toolbar object.

I thin what I want is something like "For Each Ctl In Me.Children" but
alas, there is no collection ".Children". If my child forms are called
MDI1, MDI2, and MDI3, how can I modify this code to display in the
dialogbox MDI1, MDI2, and MDI3.

Thank you
Tony
Nov 20 '05 #1
3 10606
Antony,
I thin what I want is something like "For Each Ctl In Me.Children" but
alas, there is no collection ".Children". Have you tried Me.MdiChildren?

Or Me.OwnedForms?

I suspect MdiChildren is the one you want, while OwnedForms is useful in
similar cases.

Hope this helps
Jay

"Antony" <to****************@hotmail.com> wrote in message
news:37**************************@posting.google.c om... Hi friends,

I have the following code in an MDI container (with 3 MDI
forms/children) with a button on the MDI container form.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Ctl As Control
For Each Ctl In Me.Controls
MsgBox(Ctl.Name)
Next
End Sub

Unfortunately when I click the button (Button1), all that is displayed
in the dialog boxes are "" and the name of the toolbar object.

I thin what I want is something like "For Each Ctl In Me.Children" but
alas, there is no collection ".Children". If my child forms are called
MDI1, MDI2, and MDI3, how can I modify this code to display in the
dialogbox MDI1, MDI2, and MDI3.

Thank you
Tony

Nov 20 '05 #2
"Antony" <to****************@hotmail.com> schrieb
Hi friends,

I have the following code in an MDI container (with 3 MDI
forms/children) with a button on the MDI container form.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim Ctl As Control
For Each Ctl In Me.Controls
MsgBox(Ctl.Name)
Next
End Sub

Unfortunately when I click the button (Button1), all that is
displayed in the dialog boxes are "" and the name of the toolbar
object.

I thin what I want is something like "For Each Ctl In Me.Children"
but alas, there is no collection ".Children". If my child forms are
called MDI1, MDI2, and MDI3, how can I modify this code to display in
the dialogbox MDI1, MDI2, and MDI3.


Browse the members of "Me". You'll find "MdiChildren".

=>
Dim Form As Form
For Each Form In Me.MdiChildren
MsgBox(Form.Name)
Next
--
Armin

Nov 20 '05 #3
Hello,

"Antony" <to****************@hotmail.com> schrieb:
I have the following code in an MDI container (with 3 MDI
forms/children) with a button on the MDI container form. [...] I thin what I want is something like "For Each Ctl In
Me.Children" but alas, there is no collection ".Children".


\\\
Dim f As Form
Dim c As Control
For Each f In Me.MdiChildren
For Each c In f.Controls
...
Next c
Next f
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4

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

Similar topics

5
by: Hal Vaughan | last post by:
I think a lot of this is definately a question of personal programming style, but I'm new to Java and would like to hear a few opinions. I'm writing a control panel for an application that runs...
55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
1
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has...
6
by: David | last post by:
I am running into situtations where confining all forms to just one window (instance of broswer) is becoming overly restrictive. Does ASP.NET provide ways to have multiple windows to interact with...
10
by: Rob Meade | last post by:
Hi all, I've got myself into a bit of a problem and I'm trying to dig my way back out, in a) the quickest way due to project deadline and also b) best approach. I have a form which gets a set...
3
by: Diana M | last post by:
Hello, I have started my first asp.net application (beginner). I have 2 text boxes on the form that should contain 2 different dates (beginning and end). It would be nice to have 2 small buttons...
7
by: Tangent | last post by:
I know this was asked before, but I never saw what the answer was... I have a webform (asp.net) that has a number of dropdownlists (and other controls). I am trying to use a For Each...Next loop...
4
by: Dino Buljubasic | last post by:
Hi, I had to improvise a control that looks like a list view with each row holding 3 radio buttons. To do this I am using a panel (mainPanel) that holds other panels representing rows...
3
by: Henry | last post by:
I know it is possible to store dynamic propterties for applications in XML files. The app.config and the web.config files can be used to store AppSettings... I am just wondering how far one can...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.