Controls that you add to a Windows form disappear when you close and reopen the Windows form in Visual C++ .NET 2003 or in Visual C++ 2005 (836732)



The information in this article applies to:

  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ 2005 Express Edition

SYMPTOMS

You add a control to a Windows form in Microsoft Visual C++ .NET 2003 or in Microsoft Visual C++ 2005, and then you click the Close button (X) to quit Design view. You are prompted to save changes to the header file of the form. Even if you save your changes when you are prompted with a dialog box, and then you reopen the Windows form, you notice that the added control disappears.

Note You notice this problem only if you click the Close button to quit Design view.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.

WORKAROUND

To work around this problem, use one of the following methods to quit Design view:
  • Switch to Code view, and then switch back to Design view before you click the Close button.
  • On the File menu, click Close.
  • Click the Save button on the toolbar before you click the Close button.

MORE INFORMATION

Steps to reproduce the problem

  1. Start Microsoft Visual Studio .NET 2003 or Microsoft Visual Studio 2005.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, click Visual C++ Projects, and then click Windows Forms Application (.NET) under Templates.

    Note In Visual Studio 2005, click Visual C++ under Project Types, and then click Windows Forms Application under Templates.
  4. In the Name box, type MyApp, and then click OK.

    By default, the Form1 Windows form is created.
  5. Add a Button control to the Form1 form.
  6. Click the Close button in Design view.
  7. To save the changes to the Form1.h file, click Yes in the Microsoft Development Environment dialog box.
  8. In Solution Explorer, double-click Form1.h under Header Files. You notice that the Button control that you added in step 5 has disappeared.

Modification Type:MajorLast Reviewed:1/11/2006
Keywords:kbWindowsForms kbManaged kbide kbForms kbDesigner kbControl KbUIDesign kbprb KB836732 kbAudDeveloper