We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

control array

sakya
sakya asked
on
Medium Priority
195 Views
Last Modified: 2010-04-04
Hello.

I want to use control array like Visual Basic.
Can I program component as array?
Please teach me how to program and a example.

 
Comment
Watch Question

Commented:
For example, an array of 3 edit boxes (alreadyt defined on the form)

in the private part of the form put : MyControlArray=Array[0..2] Of TEdit;
in the OnCreate event of the form put :
MyControlArray[0]:=Edit1;
MyControlArray[1]:=Edit2;
MyControlArray[2]:=Edit3;

Then you can use them whereever you want by either using Edit1, Edit2, Edit3 or MyControlArray[i].

Author

Commented:
Yes,but I know this way.
I want more cool code because my application has hundreds of components,

Help.


Commented:
Any component has property Components and ComponentCount.
Components lists of all components owned by the component.

Any wincontrol has property Controls and ControlCount.
The Controls property is an array of all controls that are children of the windowed control.

Try to use it.

Commented:
you could also use a TList to contain your components...

Author

Commented:
Thanks vladika.
Thanks ZifNab.

I will try.



Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
viktornet. Thanks for  your good  examples.

 
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.