Quote:
>What is a Hash Tablet, and how can I do it in Visual Basic? (VB 3.0
>Pro)
>Also are there any other way to access data faster than using a
>For...Next?
>Thanks!
A hash Table (not tablet) is a way to organize data faster than just a clump.
Think of it as mail slots in a hotel. You assign each piece of data to a
specific slot. If you have 10,000 elements, you may want 100 hash slots
(stored as an array) with an average of 100 elements in each slot. If you
know that "data1" is located in slot 43 you only need to search slot 43 for
the data (only 100 elements on average to check) as opposed to all 10,000.
This is much faster.
It is called a hash table because you hash the data to decide where it should
go. Say your data is words. you could use the first letter to determine
where it goes (all a words in slot a, all b words in slot b, etc.) Hashing
unfortunately has a tendency to clump certain slots and leave other slots
empty, making the system less efficient. If you have a lot of p words and no
x words, this hash would not work well. I will leave it up to you to research
the best method to hash, but a hint is to use a prime number of hash slots
becase that tends to spread things out best. Why, because if you have a
divisable number of slots, you get patterns of repetition.
Oh, one other thing, because you have a fixed number of slots you can store
them as a fixed array, which means that there is no searching on the slot
itself. You will need to search in the slot for the item however.
As for your question about the for...next loop. I would use an external
datasource like a mdb file and simply have the database do the work for you.
It is really easy to connect and use a database. You can even link controls
like textboxes directly to data fields.
Hope this answers your question.
-brian