Static Array Question

JTB

New member
Local time
Today, 06:26
Joined
Sep 22, 2006
Messages
5
Hi,

I'm creating a form where forecasts can be entered for the months of various years. I'm only displaying the months one year at a time, and then you can move to the next month by clicking the next button. Twelve text boxes are used to show the forecast values for the months of the current year, and when the displayed year is changed I want to store the new forecasts in the array and then load the next year's forecasts in the text box. Once the user has entered in all the values they want for the various years they will click a button and all the forecasts will then be stored in the appropriate table.

I thought I could use a static array to store the values as the help file says that when a static variable is used in a form object, it is accessible and retains it's values until that form is closed. Unfortunately this does not seem to be working for me so was wondering if anyone had any advice for whether this is possible.

Thanks!
 
you could just use a global array in that form, which does the same thing. but a static array should maintain its value, rather than being initiallised each time you call the function in which its declared.

the only reason for defining an array in a function is that it limits the scope of the array to that function, and therefore avoids code errors or side effects, if you inadvertently reference the variable from somewhere else. if you know you aren't doing that it doesn't matter whether its local static, or global

Perhaps you are not quite handling the array correctly. What are you doing with it?
 
Good call, I'll just use a global array.
Thanks for the input!
 

Users who are viewing this thread

Back
Top Bottom