Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass and return a value in a modal form?
Message
 
À
15/09/2000 23:07:20
Marlou Gargantos
Independent Consultant
Manila, Philippines
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00416948
Message ID:
00417256
Vues:
29
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform