The Software Development Kit WinTalk sample cannot be opened in Design view in Visual Studio .NET (834062)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

WinTalk is a Microsoft Visual Studio .NET Software Development Kit (SDK) sample. When you try to open the WinTalk sample in Design view in Visual Studio .NET, you may receive the following error message:
An error occured while loading the document. Fix the error, and try loading the document again. The error message follows:

The class TalkForm can be designed, but is not the first class in the file. Visual studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again.
Note In this error message, the word "occured" is misspelled with one "r".

CAUSE

To design the form, the Design view of the form uses the first class that is in the Code view of the form. If the TalkForm class that is used to design the form is not at the beginning of the Code view of the form, you may receive the error message that is mentioned in the "Symptoms" section.

WORKAROUND

To work around this problem, follow these steps:
  1. Locate the WinTalk folder. Open a Visual Basic .NET project in the WinTalk folder.
  2. In Microsoft Solution Explorer, click the WinTalk.vb file.
  3. On the View menu, click Code.

    The Code view of the form appears.

    Note
    The Code view of the form has three classes. The three classes are:
    • The App class
    • The TalkForm class
    • The Talker class
    The TalkForm class inherits from the Form class.
  4. Locate the following code in the WinTalk.vb file:
    Imports Microsoft.VisualBasic
  5. Move the code that corresponds to the TalkForm class and then put that code below the code that you located in the step 4.

    The WinTalk form Designer view opens without error.

MORE INFORMATION

Steps to reproduce the problem

  1. Start Visual Studio .NET.
  2. On the File menu, point to Open, and then click Project.

    The Open Project dialog box appears.
  3. In the Look in box, click the WinTalk project.

    Note The Visual Basic .NET version of the WinTalk project is typically located at C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Applications\WinTalk\vb.

    The Microsoft Visual C# .NET version of the WinTalk project is typically located at C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Samples\Applications\WinTalk\cs.
  4. Locate the WinTalk\VB folder, and then click the WinTalkVb.sln file.
  5. Click Open.
  6. In Solution Explorer, double-click WinTalk.vb.

    You may receive the error message that is mentioned in the "Symptoms" section.

REFERENCES

For additional information about the custom design-time control features in Visual Studio .NET, visit the following Microsoft Developer Network (MSDN) Web site:For additional information about building Windows forms controls and components with rich design-time features, visit the following MSDN Web site:

Modification Type:MinorLast Reviewed:2/9/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbWindowsForms kbDesigner kbprb KB834062 kbAudDeveloper