Home » VB 6 Variable Scope

VB 6 Variable Scope

The scope of a VB 6 variable decide the lifetime of that variable. There are 3 levels of scope for a variable in Visual Basic 6.

In this article, you will learn about the scope of variables with examples in a Visual Basic 6 project.

Level of Scope

The scope in many programming languages is either a global scope or a local scope. We will list out the global scope and local scope for a variable in visual basic 6.

Visual Basic 6 has 3 levels of scope:

  1. Module Level with Public (Global)
  2. Form or Module level (Global only to the Module).
  3. Procedure Level (Local scope)

Module Level With Public

Variables declared in the general section of the code editor using keyword Public are visible in all forms and modules throughout the VB 6 Project.

Example:

(adsbygoogle = window.adsbygoogle || []).push({}); </script

Please support us by disabling your adblocker or whitelist this site from your adblocker. Thanks!

turn of adblocker imag

(adsbygoogle = window.adsbygoogle || []).push({});