Cerebrus
unread,Mar 30, 2011, 3:00:09 AM3/30/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
You're missing the cast to the type of control you are referencing.
The Controls property lists a collection of all child controls
implicitly cast as the base Control class. The error message is
correctly telling you that the Control class does not have a ReadOnly
property.
For example,
---
private void ToggleControls(bool enabled)
{
foreach(Control ctl in MyGroupBox.Controls)
{
if (ctl is TextBox)
{
TextBox txt = ctl as TextBox;
txt.ReadOnly = enabled;
}
else if (ctl is ComboBox)
{
ComboBox cmb = ctl as ComboBox;
cmb.Enabled = enabled;
}
}
}
---
On Mar 28, 10:06 pm, southstander132 <
southstander...@gmail.com>
wrote: