By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,166 Members | 1,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,166 IT Pros & Developers. It's quick & easy.

Getting list of controls in Design mode.

P: n/a
Hi Everyone,
I need to write a utility for an app that will get the list of controls on
the form. I would also need to get the info on how the parent is, ect... What
is the best way to go about this? Thanks for any suggestion.
Michael Lee

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Michael,

Looping through Me.Controls in your form class will give you access to each
of the controls that exists on the form.

Is this what you were looking for?

HTH
Nov 21 '05 #2

P: n/a
"Michael" <Mi*****@discussions.microsoft.com> schrieb:
I need to write a utility for an app that will get the list of controls on
the form. I would also need to get the info on how the parent is, ect...


You can recursively enumerate the controls. Take a look at the
implementation of 'FindControl', it will give you the idea:

Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
Hi Sarika,
Thanks for the reply. I was hoping I could do that in the design mode with
an add-in or something. I know I can do that in run mode. I saw a project on
the net that you dropped on the form and it was suppose to output an xml file
when the form was saved. I was looking to do something like that. And I also
know that I would have to write the xml convertion code. Thanks again for the
reply.

"Sarika" wrote:
Michael,

Looping through Me.Controls in your form class will give you access to each
of the controls that exists on the form.

Is this what you were looking for?

HTH

Nov 21 '05 #4

P: n/a
O...Okay...Hmm......Here is a thought, although it might not be the ideal
solution or what you are looking for.

The InitializeComponent method has iniitalization code for the controls in
your form. So your addin would parse this function and maybe till you
encounter a New in it => it is a new control on the Form, something like
that.

I am sure there is a better approach to doing this


Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.