15
votes

I'm trying to change properties to a control however it seems as if it's "locked" but in reality, it isn't because when I right-click on the control it shows the control as being unlocked.

I'm using Visual Studio 2005, and I've never worked with a control that seems to be locked as such in the picture provided.

I'd really appreciate a simple explanation and how to resolve this issue so that I can proceed with modifying it.

enter image description here

7
What source control system are you using? - Oded
not very sure, but probably that control is defined in other file. In other words, you see the Host that holds the control. - Tigran
It might be attach to a process. Did you pressed F5 to run the project and then switch to VS and trying to edit control. If this is the case you need to stop debugger. - particle
Are those controls on a UserControl which you've placed on your form? If so then you have to open the UserControl and change the modifier property on each of the controls you want to be able to modify. Or you could just modify them on the UserControl itself, if that won't break something else. - Igby Largeman

7 Answers

24
votes

This will happen when you try to design an inherited form and the control(s) on that form are private. The designer observes accessibility modifiers. Go back to the base form and change the Modifiers property of the controls from Private to Protected.

4
votes

I was suffering exactly the same issue but it was just happening with DevExpress controls.

After some hours of changing modifiers and shooting myself in the feet I found this option on Visual Studio => DevExpress => WinForms Controls vX.X.X => Change Design-Time settings => Enable visual inheritance for Developer Express controls used in Visual Studio.

enter image description here

3
votes

Right click on the form and uncheck option "lock controls"

This should help.

0
votes

Go to the base code of the form solution explorer--> formXX --> Dispose(Boolean) and change inheritance line to Inherits System.Windows.Forms.Form

0
votes

If you have form A which name is "Form.cs" in your project, classes from other form's (B, C, D, etc.) will be inheritance class "Form.cs" from your "A"... it should inheritance System.Windows.Forms.Form. Just try change your A forms class name from "Form.cs" to "Form1.cs".

0
votes

When you are adding a new Inherited form, and want to have all controls unlocked, go to the Form you are Inheriting from, select Designer.cs file and change the controls you want changed to protected. Once that is done, build your solution and then create the inherited form. The controls should become unlocked.

0
votes

Just now I ran into a similar problem after restoring a .CS from a backup directory. The reason for not being able to edit, was that the (back up) file had been created in READ ONLY mode. Once the 'read only' property through explorer was removed and after refreshing the C# project, the problem was solved.