Visual Basic 6 Function Procedures

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Function is a series of statements enclosed by "Function" and "End Function" statements.

The Function performs an activity and returns control to the caller. When it returns control, it also returns a value to the calling code.

You can define a Function in a Class, Structure & Module. By default It is Public. It means, you can call it from anywhere in your application that has access to the class, Structure or Module in which you defined it.

Syntax

  • [Modifiers] Function Name_Of_The_Function [(Arg_List)] As Return_Type
  • [Statements]
  • End Function

Remarks

  • The two Function Modifiers used in this examples are Public & Private. This Modifiers define the scope of the Function.
  • Functions with a Private scope can only be called from the source file from where they were defined. In our case it can be called with in the Module. And cannot be called outside the Module.
  • Functions with Public scope can be called both outside and inside the Module. Simply we can say as "We can call it any where in the program".
  • Default Modifier of the Function is Public.
  • By default, the function arguments are passed by reference (In a separate topic, this will be explained in detail).


Got any Visual Basic 6 Question?