I was working with a customer the other day and came accross an interesting issue:

Controls on a form within the Windows Form Designer appeared locked and could not be moved or edited within the form designer. However, we were still able to modify properties for controls on the form using the property pages. This behavior occurs despite the lack of the Locked property being set. Controls appear normal on the form (i.e. Locked controls have a white and black bounding box around the control.) but behaved as if locked.

Please note that the locked property is a property of the windows form designer and not a member of the control class.  The locked property is part of the form designer behavior.  The information on design properties is stored within the resource file (.resx) for the form.  The XML for the locked property for a button on a form looks like:

<data name="Button1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">



This behavior is caused by a corruption within the .user file for the project. This corruption prevents the windows form designer from properly executing.  To resolve this issue close VS.NET, delete the .user (or rename it) file for the project and reopen the solution.

In my scenario I applied the resolution as stated above then I closed VS.NET, reverted the .user file and reopened the solution.  This allowed the customer to revert to the customized settings stored within the .user file whithout having to recreate them.  IMO what I think is happening is that when you open the .vbproj (or .csproj) file without the .user file the project settings are reverted to default values and saved when you closed the project.  Then, when you put the .user file back and open VS.NET the .user file is read and the corrupted setting is either ignored or discarded.  I didn't spend too much time on investigating what setting was affecting my customer but I'll be sure next time I come across this to investigate it a bit further.


If you're interested I'm participating in two online chats (http://msdn.microsoft.com/chats) in March:

Programming Essentials in Visual Basic .NET - March 16, 2004 4:00 - 5:00 P.M. Eastern time
OutlookAdd to Outlook Calendar

Threading with Visual Basic .NET - March 23, 2004  4:00 - 5:00 P.M. Eastern time
OutlookAdd to Outlook Calendar