>>>> 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; > }Thank you, Viv.
((TextBox)c).CharacterCasing = CharacterCasing.Upper;The one I used worked but I prefer this one and I substituted it.