Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question
Message
From
06/07/2010 11:06:07
 
 
To
06/07/2010 10:49:34
Bill Fitzgerald (Online)
Woodbury Systems Group
Hamilton, New Jersey, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01471507
Message ID:
01471524
Views:
51
>>>string s = "textBoxColumn" + column.ToString();
>>>((TextBox)this.Controls.Find(s, true)[0]).ForeColor = textboxforecolor;
>
>Right on the money, Viv. Thanks. And yes, it's in a for loop
>
>Here's another one for you:
>
>Suppose I wanted to create a button named "button" + column for each value of column???

I guess just something like:
for (int i = 1; i < 53; i++)
            {
                Button b = new Button();
                b.Name = "Button"+i.ToString();
                //Set position, size etc....
                Controls.Add(b);
            }
Don't know how you'd want to handle positioning though.... (One of those times when WPF would shine :-} )
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform