c_edward_b

Sometimes when I place a form, for example a button, on my interface and rename it (by typing new text like "try_estimate" into the [name] field in the Properties window), during later work the name will change back to whatever its default name was, for example "button1". If I have code behind it, the code breaks. On my latest project I've given up and stayed with the default names and kept a list of what "button1" does etc, rather than going through this multiple times. What dumb thing am I doing wrong

Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

Christopher Payne

What version of Visual Studio are you using (including service pack)

This sounds similar to what I've seen happen in Visual Studio 2002 (e.g. .Net 1.0). If you opened the designer of your form when there is a compile error anywhere in your project, controls tended to disappear, usually leaving their declaration behind in the code so you can't just place a new control and give it the same name it had before. The only work around I ever found was to close the designer and code windows without saving changes, then find the compile error and fix it. Then, if I was lucky and the corrupt version of the form or user control did not get saved, it would work properly. If I was unlucky and this happened, I would have to revert to the previous version in SourceSafe.

Later versions of Visual Studio have been less likely to exibit this behavior, resulting in a reduction in the rate of my hair loss...




Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

c_edward_b

Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Standard

Microsoft Visual Basic 2005 77633-235-2945591-41019
Microsoft Visual Basic 2005

Microsoft Visual C# 2005 77633-235-2945591-41019
Microsoft Visual C# 2005

Microsoft Visual C++ 2005 77633-235-2945591-41019
Microsoft Visual C++ 2005

Microsoft Visual J# 2005 77633-235-2945591-41019
Microsoft Visual J# 2005

Microsoft Visual Web Developer 2005 77633-235-2945591-41019
Microsoft Visual Web Developer 2005

Security Update for Microsoft Visual Studio 2005 Standard Edition - ENU (KB925674)
This Security Update is for Microsoft Visual Studio 2005 Standard Edition - ENU. \n
If you later install a more recent service pack, this Security Update will be uninstalled automatically. \n
For more information, visit http://support.microsoft.com/kb/925674





Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

Christopher Payne

Sorry, I haven't experienced this in 2005.





Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

Figo Fei - MSFT

Hi, c_edward_b

You can do the following steps to deal with the case:

1. Reboot the machine into Safe Mode. Do we still have the problem This can isolate some third party application/driver¡¯s interference.

2. If we switch to try a new user account, do we have the problem This can rule out the possibility of corrupted user profile.

3. Do we have any third party add-ins loaded Disable them with ¡°Tools¡± | ¡°Add-in Manager¡­¡±

Make sure you've installed the sp1 for Visual Studio.

Thanks






Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

c_edward_b

Thanks, Figo Fei, I will try these things. I gather there isn't something different I should be doing to not cause this problem myself

It is hard to reproduce the problem. I have not found an exact set of operations that will make form names revert to defaults right when I want to demonstrate this. So I'm not sure how to prove the problem's fixed, other than to work for a long time on several projects without seeing it. But on this one project it's happening pretty frequently.

I have a question about working on this problem. What exactly should I do to change the name of a form, once there's code behind it Should I change it on Form1.cs, on Form1.Designer.cs, on Form1.cs [Design], and on Program.cs Should I change it anyplace else Does VS try to propagate a change in any of these places to any other places Is there a proper place to change it so that VS can propagate the change everyplace else Does it matter what order I make the changes

I'm new to VS and don't feel like I understand how the different things I can see interact with each other. I'm not sure I can see all the places that matter. For example, I'm not clear how many places VS keeps information about one particular project. I have plenty of step by step instructions about how to name a form. This isn't enough to build the right mental picture of what the system normally does, so I can understand what's going wrong here instead. Is there some reference I can read that explains how VS is coordinating things between these different files

Thanks!





Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

c_edward_b

Which Visual Studio SP1 do I use

Team Suite I'm not using Team Suite.

Update for Vista I'm not using Vista.

C++ Redistributal Package I'm not using C++ enough to see the problem there.

Express Editions I'm not using Express.

Library for VS SP1

SQL Server Compact Edition Not using SQL.

Team Foundation Server

SQL Server Everywhere Edition

These are the only items I see when I search for "visual studio 2005 sp1". With fewer search terms there are more choices but still none look right.

It's possible I installed sp1 already. How can I tell I think I tried to install some service pack for C# Express, but failed, months ago when I was using that before I got VS. Not certain.

Thanks!





Re: Visual C# IDE Form [name] spontaneously changes back to button1 or whatever?

Figo Fei - MSFT

Hi, c_edward_b

SP1 for VS download here: http://www.microsoft.com/downloads/details.aspx familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc

Note: This download installs Service Pack 1 for MicrosoftR Visual StudioR 2005 Standard, Professional, Team Editions.

To change the name of the form (notice the name not the text in the title bar):

We can manually change the form's name in *.cs source code file (Form1.cs and Form1.Designer.cs for instance), Change the class name from Form1 to other name.

Change the name in both file (*.cs and *.Designer.cs).

Similar operations with other controls' name, if you want to change.

Thanks