changing properties for all controls in a collection
Posted on 2003-03-11
I have approximately 20 textboxes on a Windows form that I need to be able to manipulate properties for.
The following code works fine for setting the 'Enabled' property. How can I use a collection of textboxes to change the 'ReadOnly' and 'BorderStyle' properties?
private void ButtonLockControls_Click(object sender, System.EventArgs e)
foreach (Control X in CurrentPanel.Controls)
if ((X.GetType().ToString()) == ("System.Windows.Forms.TextBox"))
X.Enabled = !(X.Enabled);