lesson 2

Cards (15)

  •  procedure
    a small program that is meant to solve a relatively small problem. Sometimes it is called a sub-procedure. There are two categories of procedures used when creating a program: those that have already been created thus made available for the programmer, and those that need to be created by the programmer them self. All executable statements in Visual Basic must be within the procedure.
  • Visual Basic programs can be broken into smaller logical > components called Procedures. Procedures are useful for condensing repeated operations such as the frequently used calculations, text and control manipulation etc.
  • FOUR (4) TYPES OF PROCEDURE IN VB.NET

    • Sub Procedure
    • Function Procedure
    • Property Procedure
    • Event Procedure
  • Sub Procedure

    Performs a task and then returns a control to the calling code, but it does not return a value to the calling code
  • Function Procedure

    Performs a task and then returns a control to the calling code. These also returns a value to the calling code
  • Property Procedure

    A series of Visual Basic statements that manipulate a custom property on a module, class or structure
  • Event Procedure

    Whenever the user takes any action such as clicking the mouse, pressing a key, or passing out on the keyboard, the action is called an event
  • To create a procedure, start by typing the Sub keyword followed by a name like everything else. It must have a name. At the end of the procedure, type the End Sub.
    Sub ProcedureName () [Procedure body] End Sub
  •  calling code
    • a statement, or an expression within the statement that specifies the procedure by name and transfers the control to it.
    • When naming a procedure, it must begin with a letter. It should not contain periods, mathematical, or comparison operators.
  • parameter
    allows the calling code to pass a value to the procedure when it calls it.
  • argument
    represents the value supplied to a procedure parameter when the programmer calls the procedure.
  • Pass By Value (ByVal)
    This argument means passing a copy of a variable to the Subroutine. The ByVal keywords indicate that the arguments passed into the variable are passed by value. Any changes made to the variable does not affect the actual variable.
  • Pass By Reference (ByRef)
     In this case, the argument will be passed by reference. It means that a reference to the original value will be sent to the function. It is almost like the original value is being directly used within the function, Operations like equal sign will affect the original value and be immediately visible in the calling function.
  • FUNCTIONS
    A function is a block of organized, reusable code that is used to perform a single and related action. Functions provide better modularity for the application and a high degree of code reusing. Function is enclosed by the Function and End Function statements. Function performs a task and then returns control to the calling code. When it returns control, it also returns a value to the calling code.
  • [Modifiers) Function FunctionName (ParameterList) As ReturnType [Statements] End Function
    Modifiers
    FunctionName
    ParameterList
    Return Type
    DECLARATION