473,385 Members | 1,821 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,385 software developers and data experts.

Getting list of controls in Design mode.

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
4 1085
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
11
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
14
by: Jan Nielsen | last post by:
Hi In Microsoft Access it is possible to write code like this Sub test() DoCmd.OpenForm "TestForm", acDesign Dim a As Control For Each a In Forms("TestForm").Controls Do stuff Next End Sub
11
by: Crirus | last post by:
I need to derive the Windows.Forms.Control 2 times so I design a class like this Public Class BMControl Inherits System.Windows.Forms.UserControl Public Class MapControl Inherits BMControl
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
0
by: Geepy | last post by:
I am implementing an Extension control that provides other Controls with a set of properties. One of the properties should be a list of values that is configurable by the user (aka developer). ...
1
by: Alec MacLean | last post by:
Hi, Outline of problem: I've built a set of user controls that are used to output questions for a survey and gather the responses using simple radio buttons. I'm adding an optional textbox...
0
by: mpathfinder | last post by:
hi guys . sorry for my weak Eng. writing . I want to design a component that in one of it's properties i'd able to collect list of controls of the windows form that hosts this component in a...
20
by: Steve | last post by:
What is the code to create a list of the controls on a closed form in the current database? Thanks! Steve
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.