>>>>> foreach (Control c in parentForm.Controls) >>>>> { >>>>> if (c is TextBox) >>>>> { >>>>> >>>>> } >>>>> } >>>>>>>>>
>>>>var c as TextBox >>>> >>>>if (c!=null) >>>> { >>>> >>>> }>>>>
>>> >>> foreach (Control c in parentForm.Controls) >>> { >>> if (c is TextBox) >>> { >>> TextBox tb = c as TextBox; >>> tb.CharacterCasing = CharacterCasing.Upper; >>> } >>> } >>>A Linq way:
foreach (Control c in parentForm.Controls.Where(x=>x is TextBox)) >> { >> ((TextBox)c).CharacterCasing = CharacterCasing.Upper; >> }>
>((TextBox)c).CharacterCasing = CharacterCasing.Upper; >>The one I used worked but I prefer this one and I substituted it.
foreach (TextBox c in parentForm.Controls.OfType< TextBox>()) { c.CharacterCasing = CharacterCasing.Upper; }