ArrayControl [modified]
-
-
Please help me. I use Visual c# 2005. I want to use some control with same name and diffrent index like control array. Please tell me i can use what property of controls like DropDownList Thanks in advance. -- modified at 14:57 Monday 13th August, 2007
You can create an array of controls if you'd like. What are you trying to do exactly ? Or do you mean the Items property on the data bound controls ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Please help me. I use Visual c# 2005. I want to use some control with same name and diffrent index like control array. Please tell me i can use what property of controls like DropDownList Thanks in advance. -- modified at 14:57 Monday 13th August, 2007
Hi, Visual Designer will not let you do this; it insists on having unique names for controls. There are two ways to solve this: - don't use VD for these controls, just create your controls programmatically, so you can give them any valid name you choose, including array[index]-like names provided you declare such an array of course. - keep the controls as they are; now create a collection (array, ArrayList, List, whatever) and add the controls to that list. BTW: maybe you don't need anything new; you can iterate over all controls in a container like this:
foreach(Control c in this.Controls) {
Button btn=c as Button;
if (btn!=null) btn.PerformClick();
}The above would find all buttons and click them one by one. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi, Visual Designer will not let you do this; it insists on having unique names for controls. There are two ways to solve this: - don't use VD for these controls, just create your controls programmatically, so you can give them any valid name you choose, including array[index]-like names provided you declare such an array of course. - keep the controls as they are; now create a collection (array, ArrayList, List, whatever) and add the controls to that list. BTW: maybe you don't need anything new; you can iterate over all controls in a container like this:
foreach(Control c in this.Controls) {
Button btn=c as Button;
if (btn!=null) btn.PerformClick();
}The above would find all buttons and click them one by one. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
And you can also examine tag property of the control to identify exactly which one it is.
#region signature my articles #endregion