Share via


The Structure of a Visual Basic Project

Consider an accounts receivable project, which contains one module and two forms. Each of the forms contains some controls. The structure of the project is shown in the following outline:

  
    Project: AccountsReceivable
   Module: MyMain
   Form: Customer
      Control: LabelCustomerName
      Control: LabelOutstandingBalance
      Control: TextCustomerName
      Control: TextOutstandingBalance
   Form: Invoice
      Control: LabelCustomerName
      Control: LabelInvoiceDate
      Control: LabelPastDueCharges
      Control: LabelCurrentCharges
      Control: LabelTotalCharges
      Control: TextCustomerName
      Control: TextInvoiceDate
      Control: TextPastDueCharges
      Control: TextCurrentCharges
      Control: TextTotalCharges
      Control: FrameInvoiceCopies
         Control: CheckboxAccountSupervisor
         Control: CheckboxRegionalCreditDept
         Control: CheckboxCollectionsDept
      Control: CommandPrintInvoice
      Control: CommandSaveWithoutPrint
      Control: CommandCancelInvoice

The AccountsReceivable project contains two forms and a module at the first outline level below the project itself. The outline shows other kinds of component organized at the next level under the two forms, but there are none shown under the MyMain module. The outline reveals a characteristic of Visual Basic projects; forms may contain controls, but modules may not.

The Invoice form contains FrameInvoiceCopies, a control that contains three other controls. Here too, the example illustrates a characteristic of Visual Basic projects; a control can contain other controls. The following figure represents the FrameInvoiceCopies control:

There are four controls visible in the figure: one frame and three checkboxes. Speaking casually, we might say that the Invoice form contains all four controls. However, it is more precise to say that the Invoice form contains only the FrameInvoiceCopies control. Each checkbox is contained not within the Invoice form, but within the FrameInvoiceCopies control.

There is a similar outline that can be created for any Visual Basic project because every Visual Basic project has an inherent structure. It is this structure that the Repository Add-in for Visual Basic stores in the repository when it populates the MDO Model. And so it is this structure that the MDO Model must accommodate.