TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tj
NA
10
0
C# WinForms Arrays of Textboxes etc.
Mar 31 2010 8:20 AM
Is there a simple, programmatic way of getting a reference to an object via the name of the object?
For example, if one created a grid of, say, 6 Textboxes in the Design Window, just wondering if there is a better way simple programmatic way of assigning an array of references to the textboxes?
i.e. a better way than hard-coding like this:
TextBox[] tb = new TextBox[6];
tb[0] = textBox1;
tb[1] = textBox2;
tb[2] = textBox3;
tb[3] = textBox4;
tb[4] = textBox5;
tb[5] = textBox6;
Could one create a
for
loop with a string of the textbox's name, i.e.
string.Format("textBox{0}",i+1)
?
But how can one assign that particular textbox by its name?
Reply
Answers (
9
)
how can I create a ppt in asp.net
How To Pass One Dimensional Array to C++ DLL?