473,396 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Components.Count

Hi,
I want show all components names on form when I press button. I wrote this
code button's.onclick event:

for (int i = 0; i<=this.components.Components.count - 1; i++)
MessageBox.Show(this.components.Components[i].ToString());

But when I click button, system show error message.

How can I show all components names on form?

Nov 16 '05 #1
3 4449
guy
like that:
for (int i = 0; i<=this.Controls.Count - 1; i++)
MessageBox.Show(this.Controls[i].Name);

"sergey" wrote:
Hi,
I want show all components names on form when I press button. I wrote this
code button's.onclick event:

for (int i = 0; i<=this.components.Components.count - 1; i++)
MessageBox.Show(this.components.Components[i].ToString());

But when I click button, system show error message.

How can I show all components names on form?

Nov 16 '05 #2
Hi guy,
Thanks for your answer,

Your code shows components which parent is form. Is there any simple way to
show all objects (parent is not important) on form?
"guy" <gu*@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
like that:
for (int i = 0; i<=this.Controls.Count - 1; i++)
MessageBox.Show(this.Controls[i].Name);

"sergey" wrote:
Hi,
I want show all components names on form when I press button. I wrote this code button's.onclick event:

for (int i = 0; i<=this.components.Components.count - 1; i++)
MessageBox.Show(this.components.Components[i].ToString());

But when I click button, system show error message.

How can I show all components names on form?

Nov 16 '05 #3
Hi,

you have to check if each control has controls like this:
void PrintControl( Control parent)
{
foreach( Control current in parent.Controls)
{
MessageBox.Show( current.ToString() );
if ( current.Controls.Count > 0 )
PrintControl( current );
}
}
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"sergey" <no****@nomail.com> wrote in message
news:uQ**************@TK2MSFTNGP10.phx.gbl...
Hi guy,
Thanks for your answer,

Your code shows components which parent is form. Is there any simple way to show all objects (parent is not important) on form?
"guy" <gu*@discussions.microsoft.com> wrote in message
news:A5**********************************@microsof t.com...
like that:
for (int i = 0; i<=this.Controls.Count - 1; i++)
MessageBox.Show(this.Controls[i].Name);

"sergey" wrote:
Hi,
I want show all components names on form when I press button. I wrote this code button's.onclick event:

for (int i = 0; i<=this.components.Components.count - 1; i++)
MessageBox.Show(this.components.Components[i].ToString());

But when I click button, system show error message.

How can I show all components names on form?


Nov 16 '05 #4

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

Similar topics

0
by: jj | last post by:
Try something like this, Assuming I wanted to access all my controls that were of type Button (I don't know what your types called "Thumbs" are, or I'd used those as an example): private void...
0
by: Shiraz | last post by:
Hi I have a question regarding the functionality of merge modules. Since this relates to my previous queries, I'll just give you a brief background on the topic. I had to make an installer for...
1
by: mehul | last post by:
Hi, I am trying to use Microsoft Office Web components in my asp.net applicaion. Actually i want to use the chart and came accross some sample code in MSDN (Kb:Use a DataSet with the Office...
3
by: DC Gringo | last post by:
Allison (or others), thank you for the advice...a few more questions: - I have tested on my workstation on Excel XP and my application references the Excel 10.0 Object Library. I was told the...
1
by: Jorge | last post by:
Hello I finally found out why context menus don't show in form.controls its a component! I did a google search and someone sugested to use the site property. The followoing code : Public...
8
by: JackRazz | last post by:
Is it possible to add an extended property to components like I can with controls via IExtenderProvider? JackRazz
7
by: sreenulanka | last post by:
please help me in my forum i have labels and textareas .iwant to add textarea components dyanamically when i am clicking the button.please help me import java.awt.*; import javax.swing.*;...
2
by: elektrongyorsito via DBMonster.com | last post by:
Hello, I have 3 tables: T_component =TCO cmp_id | name 1 | door 2 | exhaust
2
by: Bruce | last post by:
Hi I am trying to come up with an algorithm to solve the following problem. There are x components and y machines (y x) one machine can only run one component. Each component has 2 requirements...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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...

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.