Obtener Controles en un contenedor C#

private void VerificacionObjetos(Control __obj__, string __valor__, bool __asignar) { foreach (Control __obj1__ in __obj__.Controls) { if (__obj1__.HasChildren) VerificacionObjetos(__obj1__, __valor__, __asignar); if (__obj1__.Tag == __valor__) __obj1__.Enabled = __asignar; } //Aqui verifico los objetos de los toolbox foreach (object __obj in barManager1.Items) { __obj.GetType(); } }
Este código encuentra todos los controles hijos y los hijos de los hijos en n niveles y permite des-habilitarlo o habilitarlos según sea el parámetro que se le envie

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.