474,064 Members | 1,433 Online
Bytes | Software Development & Data Engineering Community
+ 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(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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 10632
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.co m> wrote in message
news:37******** *************** ***@posting.goo gle.com... 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(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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.co m> 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(B yVal sender As System.Object, ByVal e
As System.EventArg s) 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 "MdiChildre n".

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

Nov 20 '05 #3
Hello,

"Antony" <to************ ****@hotmail.co m> 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
2989
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 separately. The control panel is basically (almost) fully self contained. It consists of a tabbed pane with 5 different tabs. Each tab has a number of different controls -- basically all the "commonly used" controls (buttons, lists, comboboxes,...
55
4724
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 not obvious how the code works if you don't know the intricacies of the Property Let/Get syntax. Likewise, I dislike (and code to minimize the use of) the VB/VBA syntax of returning a value by referring to the function name as if it were a...
2
8426
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 submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
1
2341
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 disapeared. The read is done on a button click. I can read the selected items from the other controls in the repeater, demo page here
6
1470
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 each other (For example, use a "child" window to fill out an order item. Once the save button is pressed, the "main" window reflects the newly added item (automatically refreshes from the database) I know that the popup calendar control can...
10
1354
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 of document type properties from SQL Server, these properties are used to create corresponding controls on the form, so for example:
3
1284
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 besides each text box that allow to open little form with calendar. I came from VB world where we had arrays of controls, but here I can't make it. Should I have 2 controls with different names and write code twice in the button click event or...
7
3821
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 to run through each of them to enable or disable them. I cannot seem to find the correct element variable/collection combination to do this. Does anyone know what I need to do to make the loop work?? Thanks,
4
1339
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 (rowPanel). So, I fetch database and for each item, I add a rowPenel with 3 radio buttons to the mainPanel. Now, for each row, there must be one radio button selected. To check
3
1483
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 go with this technique. In my case, what I am interested in doing is to store information about reports and report parameters that I might want to use in an XML file. Ideally I'd like to get to the point answer and respond to the following...
0
10401
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
11653
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10381
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
6722
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6920
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5484
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
2
4983
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
4031
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.