Share via


Creating a Forms-Based Application

OverviewHow Do IDetails

A form is dialog box with controls that let a user access and possibly change data. You may want to develop an application in which the user chooses from a selection of forms. Commonly, a forms-based application lets the user access forms by selecting New from the File menu. A dialog-based application, which does not give users access to a New option in the File menu, is also considered a forms-based application.

To create a forms-based application:

  • In Step 1 of the MFC AppWizard, select the Document/View architecture support? check box.

  • Also in Step 1 of the wizard, select Single document, Multiple documents, or Dialog based. A single document interface, forms-based application only allows one instance of a particular form to run at a time. However, it is possible to run different forms at the same time from an SDI, forms-based application by selecting a new form from the New option in the File menu.

    If you create an MDI, forms-based application, the program will be able to support multiple instances of the same form.

    An SDI or MDI forms-based application both use the document/view architecture.

    Any dialog-based application, by definition, is forms based. However, you will not be able to add additional forms to the dialog-based application via the New Form option in the Insert menu. Because a dialog-based application does not use the document/view architecture, you will have to manage the creation and access methods for your own additional forms.

  • In Step 6 of the wizard and if you chose a single document or multiple document interface application in Step 1, select as the base class for your application's View. If your application has database support, you can also select any class that derives from CFormView. A form is any window derived from CFormView or from any class that inherits from CFormView.

    Even if you choose a base class such as , you can later make your applications forms-based by adding forms with the New Form option of the Insert menu.

After you finish with the wizard, your project will open and if you selected CFormView (or a class that inherits from CFormView) as your base class, Visual C++ will open the dialog editor and you will be ready to design your first form.

See Also   Form Topics.