How do I set a static variable value? 
Author Message
 How do I set a static variable value?

Folks.

If I declare a static variable like this:

Static Dim X As Integer

then X is initialised to 0. How do I set the initial value to say 241?
In C terms, I want the equivalent of:

static long int X = 241;

Any ideas?

Peter



Tue, 25 Sep 2001 03:00:00 GMT  
 How do I set a static variable value?
Set a flag (also static) the first time through and use it as a test to see
if the Static needs to be initialized. Then initialize it manually:

static X as Integer
static flag as integer

if flag = 0 then
    X = 241
    flag = 1
end if

Brian-

Quote:

>Folks.

>If I declare a static variable like this:

>Static Dim X As Integer

>then X is initialised to 0. How do I set the initial value to say 241?
>In C terms, I want the equivalent of:

>static long int X = 241;

>Any ideas?

>Peter



Tue, 25 Sep 2001 03:00:00 GMT  
 How do I set a static variable value?
Maybe you need two static variables to do this?

Static blnInitialized as Boolean
Static X as Integer
If Not  blnInitialized Then
X=241
blnInitialized =True
End If
........
Neila

Quote:

>Folks.

>If I declare a static variable like this:

>Static Dim X As Integer

>then X is initialised to 0. How do I set the initial value to say 241?
>In C terms, I want the equivalent of:

>static long int X = 241;

>Any ideas?

>Peter



Tue, 25 Sep 2001 03:00:00 GMT  
 How do I set a static variable value?
you miay not like this BUT
private function muFunction()
static valye as integer
static first as integer ' set to 0

    if(first = 0) then
        value = 234
        fidst = 1
    end if

etc.

you might also check the "initial" " default" value of a Bool (first as
bool)

Quote:

> Folks.

> If I declare a static variable like this:

> Static Dim X As Integer

> then X is initialised to 0. How do I set the initial value to say 241?
> In C terms, I want the equivalent of:

> static long int X = 241;

> Any ideas?

> Peter

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Most of what I have learned has been taught to me by others.
I guess that means I have to teach others what I have learned
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lately It Occurs To Me
What A Long Strange Trip Its Been
(R. Hunter)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Tue, 25 Sep 2001 03:00:00 GMT  
 How do I set a static variable value?
seems like booleans are default to false:,
same logic though.

Quote:

> Folks.

> If I declare a static variable like this:

> Static Dim X As Integer

> then X is initialised to 0. How do I set the initial value to say 241?
> In C terms, I want the equivalent of:

> static long int X = 241;

> Any ideas?

> Peter

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Most of what I have learned has been taught to me by others.
I guess that means I have to teach others what I have learned
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lately It Occurs To Me
What A Long Strange Trip Its Been
(R. Hunter)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Tue, 25 Sep 2001 03:00:00 GMT  
 How do I set a static variable value?
Folks,

tks for the replies. All consistent with each other so it seems it's the only
way. I just thought it could be initialised at design time, much like the
syntax of a Const...

Quote:

> Maybe you need two static variables to do this?

> Static blnInitialized as Boolean
> Static X as Integer
> If Not  blnInitialized Then
> X=241
> blnInitialized =True
> End If
> ........
> Neila


> >Folks.

> >If I declare a static variable like this:

> >Static Dim X As Integer

> >then X is initialised to 0. How do I set the initial value to say 241?
> >In C terms, I want the equivalent of:

> >static long int X = 241;

> >Any ideas?

> >Peter



Wed, 26 Sep 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How do you set the initial value of a Static variable

2. Would like to get value from local static variable

3. Static variable not static enough ???

4. How to set static user variable with VBScript

5. setting file.value -- can it be done?

6. Set Variable = Field Value

7. Setting a variable to the largest record value.

8. Setting Bookmark to Variable value

9. Create an AutoTextEntry with it's value set to a document variable

10. Set many "values" to variables

11. Set a text file as variable value

12. Setting the value of a server variable from a client script

 

 
Powered by phpBB® Forum Software