
January 21st, 2004, 04:22 AM
|
 |
Contributing User
|
|
Join Date: Oct 2003
Location: Germany (currently)
Posts: 83
Time spent in forums: < 1 sec
Reputation Power: 5
|
|
|
Keeping Array Contents alive accross Functions
Hi,
I have ran into a problem which is most likely a simple solution but none I have found myself yet.
Problem is as follows,
I have comboboxes which apply filters similar to the excel filter techniques to a listview which contains data populated from a database.
Now depending on the combobox selected it needs to build a new SQL statement and filter the results such as the order the user applied the filters. (this sounds a strange way to do it, but it all depends on the current filter and in which sequence it is ordered, for example if I apply the filter for "contract no", it will filter the contract number from the original listview contents, and then if I filter "product name" it will filter the contents of the listview again, but if for the same contract a different product name is selected it has to query the database again)
All that is great, but the combobox control does not have a nother property which can hold strings, because as I am populating the combobox listitems I can set what is visually there but what the actual list content programatically means I cannot assign to a different property of combobox (unless integer but i dont want integer), so I decided to build an array dynamically which holds the recordset.recordcount address as its dimension (eg. record 0 = i = 0 as dimension in array), thats all well, but visual basic tells me I cannot declare an array as public, thats also ok, what it cant do it cant do, but I need to access the array from a different function when applying a different filter.
But the array contents are erased for some dumb reason, when attempting to retrieve its contents.
Yes the array is Dim'ed at the top of the code (without dimensions)
No I do not wish to use databound controls.
And yes the addresses of each array content against the listindex address are the same.
My problem is simply, how can I keep the array contents globally alive until Unload is called?
__________________
The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean, "Someone who loves to program and enjoys being clever about it."
--------------------
"Its not a bug, its a feature" (Epic Games)
|