Could I index controls?
-
This is a feature I've seen with the picture control on VB, but could I do that with text boxes or buttons on C#? I´m trying to change some properties of textboxes but I want to use iteration. For instance, I want to assign the for cycle counter's value to each textbox and display it. 1 for textbox1.text, 2 for textbox2.text and so on. If anybody has another method to do this please tell me. I hope made myself clear and excuse my english. Regards Ivan
-
This is a feature I've seen with the picture control on VB, but could I do that with text boxes or buttons on C#? I´m trying to change some properties of textboxes but I want to use iteration. For instance, I want to assign the for cycle counter's value to each textbox and display it. 1 for textbox1.text, 2 for textbox2.text and so on. If anybody has another method to do this please tell me. I hope made myself clear and excuse my english. Regards Ivan
You can create an array of pretty much any type (in your case text boxes). Note: Pseudo Code
TextBox[] myTextBoxes = new TextBox[5]
for(int index = 0; index < myTextBoxes.Length; index++)
{
myTextBoxes[index] = new TextBox();
myTextBoxes[index].Text = String.Format("TextBox #{0}", index+1);
}Don't be overcome by evil, but overcome evil with good
-
This is a feature I've seen with the picture control on VB, but could I do that with text boxes or buttons on C#? I´m trying to change some properties of textboxes but I want to use iteration. For instance, I want to assign the for cycle counter's value to each textbox and display it. 1 for textbox1.text, 2 for textbox2.text and so on. If anybody has another method to do this please tell me. I hope made myself clear and excuse my english. Regards Ivan
-
This is a feature I've seen with the picture control on VB, but could I do that with text boxes or buttons on C#? I´m trying to change some properties of textboxes but I want to use iteration. For instance, I want to assign the for cycle counter's value to each textbox and display it. 1 for textbox1.text, 2 for textbox2.text and so on. If anybody has another method to do this please tell me. I hope made myself clear and excuse my english. Regards Ivan
Thank you a lot, your aid was really helpful Ivan