Most welcome! Have a good one ! :-) On Apr 2, 9:31 pm, Lori Costanzo <[email protected]> wrote: > That's exactly what I couldn't figure out how to do - thanks much - worked > like a charm and I am moving forward! > > > > On Wed, Mar 30, 2011 at 1:00 AM, Cerebrus <[email protected]> wrote: > > 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 <[email protected]> > > wrote: > > > Greetings, > > > > I know how to loop thru controls in a groupbox and disable them, or make > > the > > > entire groupbox enabled = false, but the users say they can't see the > > text > > > when the fields are disabled - the color is greyed out and too light. I > > > can't figure out how to make these fields (text boxes, comboboxes, etc.) > > > readonly instead. I get the error: > > > > Error 2 'System.Windows.Forms.Control' does not contain a definition for > > > 'Readonly' and no extension method 'Readonly' accepting a first argument > > of > > > type 'System.Windows.Forms.Control' could be found (are you missing a > > using > > > directive or an assembly reference?) > > > > Is there any way to do this? Or are they just stucked with greyed out > > text? > > > > Thanks so much in advance! > > > -- > > You received this message because you are subscribed to the Google > > Groups "DotNetDevelopment, VB.NET <http://vb.net/>, C# .NET, > > ADO.NET<http://ado.net/>, > > ASP.NET <http://asp.net/>, XML, XML > > Web Services,.NET Remoting" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en > > or visit the group website athttp://megasolutions.net- Hide quoted text - > > - Show quoted text -
-- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net
