المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Is this an acceptable way to make a Control Array? [modified]



C# Programming
12-05-2009, 03:12 AM
Control[] controlArrays = new Control[3];

controlArray[0] = textbox1; //name of the textbox control on the form
controlArray[1] = textbox2;
controlArray[2] = textbox3;

for(int i = 0; i < controlArrays.Length; i++)
{
if(controlArray[i] is TextBox)
(TextBox)controlArray[i].Text = "My Array #" + i.ToString();
}


Thanks.

modified on Friday, December 4, 2009 12:13 AM