Add Procedure

Top  Previous  Next

The Add Procedure feature allows you to add procedures (functions, properties or subroutines) to the source code easily through a dialog.

MZ-Tools offers the following ways to show the Add Procedure window:

  • The Tools | MZ-Tools | Add Procedure... menu.
  • The MZ-Tools | Add Procedure... context menu of a code window.
  • The Add Procedure... button on the MZ-Tools toolbar.
  • The shortcut customized in the Options window, Shortcuts tab.

The Add Procedure window is the following:

add_procedure

In this window you can enter the following:

  • The name of the procedure.
  • The scope of the procedure: Public, Friend or Private.
  • The type of procedure: property (Get and/or Let/Set), function or subroutine. In the case of properties, MZ-Tools suggests a name for the member variable, although you can change it.
  • The arguments of a function or subroutine.
  • The data type of a property or function. It can be a simple type of Visual Basic, a class, an enum, a collection or a control. You can enter the type directly in the editable combobox or you can fill the list with available types clicking the Fill button.
  • If you want to add a procedure header and / or error handler to the procedure.

When you click the Add button (or press the Enter key), the procedure is added to the current module. You can repeat the operation several times with different values before closing the window.

Remarks:

  • In the case of properties, the member variable is declared at the end of the General Declarations section, but before the Windows APIs declarations if they exist. If it is a member variable which is not a simple type, MZ-Tools sets its value to Nothing in the Unload event (case of Forms) or Terminate (case of Classes, UserControls or UserDocuments).
  • If the current line is a blank line between two procedures, then the procedure is inserted at that line. Otherwise, it is appended to the end of the module.
  • You can use this feature to convert a public variable to a property.
  • You can customize the nomenclature preferences for member variables and property parameters in the Options window, Nomenclature tab.

See Also:

Convert Public Variable To Property

Add Error Handler

Add Procedure Header

Nomenclature Customization

Error Handler Customization

Procedure Header Customization

Shortcuts Customization