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

Home Posts Topics Members FAQ

Components.Coun t

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

for (int i = 0; i<=this.compone nts.Components. count - 1; i++)
MessageBox.Show (this.component s.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 4482
guy
like that:
for (int i = 0; i<=this.Control s.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.onclic k event:

for (int i = 0; i<=this.compone nts.Components. count - 1; i++)
MessageBox.Show (this.component s.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*@discussion s.microsoft.com > wrote in message
news:A5******** *************** ***********@mic rosoft.com...
like that:
for (int i = 0; i<=this.Control s.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.onclic k event:

for (int i = 0; i<=this.compone nts.Components. count - 1; i++)
MessageBox.Show (this.component s.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.ToStrin g() );
if ( current.Control s.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******** ******@TK2MSFTN GP10.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*@discussion s.microsoft.com > wrote in message
news:A5******** *************** ***********@mic rosoft.com...
like that:
for (int i = 0; i<=this.Control s.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.onclic k event:

for (int i = 0; i<=this.compone nts.Components. count - 1; i++)
MessageBox.Show (this.component s.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
1252
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 LoopControls(){ Button btn; // foreach loop foreach(Control ctrl in this.Controls){
0
2753
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 an application which was to share dlls with another application and these dlls were not self-registering. Someone on the forum suggested a few methods for the Visual studio installer, but since I had been using another software, a certain...
1
1554
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 XP Chart Component and ASP.NET) .
3
2556
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 server has the "Office 2003" components which I'm assuming is OWC11. How do my imports, declarations or other code change to account for the components versus having Excel installed? Imports Microsoft.VisualBasic
1
1038
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 Sub teste(ByVal f As Form)
8
2471
by: JackRazz | last post by:
Is it possible to add an extended property to components like I can with controls via IExtenderProvider? JackRazz
7
2641
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.*; import javax.swing.event.*; import java.awt.event.*; import java.io.*; import java.applet.*;
2
2709
by: elektrongyorsito via DBMonster.com | last post by:
Hello, I have 3 tables: T_component =TCO cmp_id | name 1 | door 2 | exhaust
2
2075
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 - memory, disk space. Each machine offers a certain memory and disk space. Match the machines to the servers. (Component1 on Machine2,Component2 on Machine5 etc)
0
9530
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
10459
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
10236
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...
0
9055
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
7552
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
6793
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
5445
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...
1
4120
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
2928
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.