Makes a private procedure or event handler.
[ modifiers ] Sub procedure_name [ type_list ] [ parameter_list ] [ return_type ] [ Where generic_constraints ] [ statements ] End [ Sub ]
[ modifiers ] Sub procedure_name [ type_list ] [ parameter_list ] Handles event_name [ Where generic_constraints ] [ statements ] End [ Sub ]
@Iterator– Specifies that the procedure implements the iterator pattern. The procedure must have a return type. See @Iterator.
@Shared– Specifies that the procedure is a member of its container, and not an instance of that container.
- Mandatory name for the procedure.
- Optional one or more names with a comma between each, all between brackets (
[ ]). See Type List for more information.
- Optional one or more declarators with a comma between each, optionally between parentheses.
But if you supply
return_type, the parentheses are mandatory. See Parameter List for more information.
- Optional in the usual construct.
- Not permitted in the event-handler construct.
- A data type
- A unit of measure
- Mandatory keyword used with the event-handler construct. See the Handles keyword section for more information.
- Optional. See Where Clause (Generics) for more information.
- Optional one or more executable statements.
- Completes the statement.
You can also use
- You can make one of these mandatory with the directive
@Option End. See @Option Directive for more information.
End Sub is not the same as
Sub is short for “subroutine”.
Handles does two things for the construct
- It changes the procedure to become an event handler.
- It puts the parameters supplied by a declaration of
Eventinto the procedure where they become available.