Iterate all controls in BindingNavigator

I have some windows forms that each has some controls including buttons,ComboBox,... and also in each form i have a Bindingnavigator control that i added some new Toolstrip buttons to it, how can i write a general method that get 3 parameters and iterate all controls on a form(including that toolstrip buttons) and enable/disable Enabled status of an special control? my method signature is like this:

Public SetStatusOf(Form frm,string controlName,bool status)


From the question, and from what I understood, you need this:

    foreach (Control c in frm.Controls)
        if (c.Name.Equals(controlName))
            c.Enabled = status;

but you can also directly use

frm.Controls[controlName].Enabled = status;

Need Your Help

Required field in model

java google-app-engine objectify

Before I was using Python NDB API and there was required attribute which I can set on properties. I can't find anything similar in Objectify documentation. How to do that with Objectify?

JOGL error with glVertexAttribPointer

java opengl jogl vao

I am tring the code below (using VAO(Vertex Buffer Object) and glDrawArraysInstanced method)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.