Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 21st, 2004, 04:22 AM
Monkey's Avatar
Monkey Monkey is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Germany (currently)
Posts: 83 Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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)

Reply With Quote
  #2  
Old January 29th, 2004, 04:21 AM
rletanab rletanab is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Philippines
Posts: 21 rletanab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to rletanab
did you try to redim and preserve the array?

Reply With Quote
  #3  
Old January 30th, 2004, 12:51 PM
Monkey's Avatar
Monkey Monkey is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Germany (currently)
Posts: 83 Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
hmmm yes i did.

and that exactely was the problem, the array was redimed in the wrong loop, so each time the loop executed the array was the recordset size but its contents where overwritten by a nested loop.

dumb me :-P

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Keeping Array Contents alive accross Functions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway