Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass and return a value in a modal form?
Message
 
To
15/09/2000 23:07:20
Marlou Gargantos
Independent Consultant
Manila, Philippines
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00416948
Message ID:
00417256
Views:
30
>BTW, in VFP we can release the variable whenever and wherever we want to without waiting for the release of the form.
>
>Public nVariable
>nVariable = 0
>some code...
>some code...
>some code...
>
>Release nVariable
>
>This way, we'll be able avoid a module suffocated with so much dead and unused variables.
>
>Would it be possible in VB?

VB treats variables differently. If you reference a variable that does not exist VB initializes it as a Variant.

The closest you can get to releasing a variable is setting a Variant variable to Empty. (You can only set Variants to Empty).
mVariable = Empty
This does nothing however to the scope of the variable.

A variable is only released when it goes out of scope, then if you try to reference it VB initializes it to Empty. Of course if you use the (highly recommended) Option Explicit statement VB will not compile your code if you have undeclared variables.
George
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform