MySQL for Visual Studio  /  MySQL Project Items  /  MySQL Windows Forms Items

8.2 MySQL Windows Forms Items

This portion of the tutorial describes how to create a Windows Form with MySQL connectivity. The item template to use for this operation is named MySQL New Windows Form. To open the Add New Item window, right-click your windows form application and select MySQL from the list of installed items.

The item template for adding a new MySQL Windows Form is similar to the MySQL MVC item template (see Section 8.1, “MySQL ASP.NET MVC Items”), but with three major differences:

  • You can create the MySQL Entity Framework model under the root path of the project.

    Figure 8.12 A MySQL Entity Framework model created in a Windows Form Application

    A MySQL Entity Framework model created in a Windows Form Application

  • When selecting the desired entity, you can also select the layout type in which the new form will display the entity data.

    Figure 8.13 The "MySQL Windows Form" Item Template dialog, with the layout options

    The "MySQL Windows Form" Item Template dialog, with the layout options

  • A Resources folder is added to the project that contains images used by the icons for the generated form.

    Figure 8.14 The Resources Folder and New Form

    The Resources Folder and New Form

The new form will have all the necessary back-end code to display the entity data, with the user interface (UI) based on the previously selected layout.

Figure 8.15 The "frmactor" Form in Design Mode

The "frmactor" Form in Design Mode

Figure 8.16 The "frmactor" Form to Display Data

The "frmactor" Form to Display Data