Share via


How to: Create Types on Class Diagrams

In Class Designer, you can create types on the class diagram by dragging them from the Class Designer toolbox. The Class Designer toolbox contains the following types:

  • Class

  • Enumeration

  • Interface

  • Abstract Class

  • Structure

  • Delegate

  • Module (Visual Basic only)

To view existing types in a project, see How to: View Existing Types.

To create a type on a class diagram

  1. From the project in Solution Explorer, open a class diagram (.cd) file.

    Tip

    If your project does not contain a class diagram file, you must first add one. For more information, see How to: Add Class Diagrams to Projects.

  2. Open the Class Designer toolbox by clicking the Toolbox tab.

    Tip

    To keep the toolbox open while you work in Class Designer, click the Auto Hide (push pin) button on the toolbox.

  3. From the Class Designer toolbox, drag a type shape to the class diagram.

    The New <Type> dialog box appears so that you can specify the name of the type, the name of the file for saving the code for the type, and the access level for the type. <Type> identifies the type that you are creating, such as Class or Enumeration.

  4. In the New <Type> dialog box, perform one of the following:

    • To accept the default values, click OK.

    • To specify different values, type the name and file name for the type, choose the access level for the type in the Access list box, and click OK.

      Tip

      To select an existing file, click the ellipsis () button next to the File name box.

    The shape representing the type appears on the diagram at the position where you dragged it. If you specified a new file name, Visual Studio creates a source code file with the name of the type in the project node in Solution Explorer. If you chose an existing file, Visual Studio adds the code for the new type to the specified file.

See Also

Tasks

How to: Define Inheritance Between Types

How to: Define Associations Between Types

Other Resources

Creating and Configuring Type Members

Working with Class Diagrams

Designing Classes and Types