Hi everybody,

In an ASP page, I need to load twice an include file that contains
variables. So I get an error message "variable redefine" I tried to test
with VarType before to define the variable (dim) with no success. Is it
faisable with VBScript to define a variable (dim) under condition.

' this code gives an error
if VarType("MyVar") = vbNull then
dim MyVar
end if


many thank's
serge

Re: Variable redefine by Michael

Michael
Sun Jul 18 16:53:40 CDT 2004

> In an ASP page, I need to load twice an include file that contains
> variables. So I get an error message "variable redefine" I tried to
> test with VarType before to define the variable (dim) with no
> success. Is it faisable with VBScript to define a variable (dim)
> under condition.
>
> ' this code gives an error
> if VarType("MyVar") = vbNull then
> dim MyVar
> end if


No, it is not possible to conditionally Dim variables...


--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US