共用方式為


Creating the Course Manager Application (Entity Framework Quickstart)

In this task, you will create the Course Manager Windows application by using Visual Studio 2008.

To create the Course Manager application by using Visual Studio

  1. On the File menu, click New Project.

  2. Choose either Visual Basic or Visual C# in the Project Types pane.

  3. Select Windows Forms Application in the Templates pane.

  4. Enter CourseManager for the project name, and then click OK.

To create the Course Viewer form

  1. In the CourseManager project, select the default form (Form1).

  2. In the File Properties pane, change the File Name to CourseViewer.vb or CourseViewer.cs.

  3. In Solution Explorer, double-click CourseViewer.vb or CourseViewer.cs to open the form.

  4. In the Properties pane, change the Name property to CourseViewer, and change the Text property to Course Viewer.

  5. In the Toolbox, expand Common Controls, drag the ComboBox control to the form, and change the name of the control to departmentList.

  6. In the Toolbox, drag the Button control to the form, change the name of the control to closeForm, and change the Text value to Close.

  7. In the Toolbox, expand Data, drag the DataGridView control to the form, and change the name of the control to courseGridView.

  8. Double-click the closeForm button control.

    This opens the code page for the form and creates the closeForm_Click event handler method.

  9. In the closeForm_Click event handler method, type the following code that closes the form:

    ' Close the form.
    Me.Close()
    
    // Close the form.
    this.Close();
    

Next Steps

You have successfully created the course manager application. Next you will generate the mapping files that describe an Entity Data Model (EDM) based on a 1:1 mapping against the School database that you created in the first task:

Generating the School Entity Data Model

See Also

Concepts

Quickstart (Entity Framework)

Other Resources

Feature Reference (Entity Framework)