Disable form input

Posted on 2011-02-22
Last Modified: 2012-08-14

I want to disable all controls on the form except command buttons

Can you help me in writing a class for this so that I can just call the class with form name
Question by:GRChandrashekar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

jimsweb earned 500 total points
ID: 34958281
It think, it is better to have a looping structure than having a separate class. you can loop through all controls in your Form1 in load event and disable it.

Expert Comment

ID: 34958286
You can also have look at this discussion, in which they make all controls read only.
LVL 20

Expert Comment

ID: 34958287
foreach(Control ctrl in this.Controls){if(typeof(ctrl)!=CommandButton){ctrl.Enabled=false;

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Send parameters via datatable ajax call 4 43
c#  FTP ftpwebrequest URI invalid 6 47
.NET Redemption/Outlook Examples 3 32
Timeouts during development 3 28
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question