[2005] Retrieve collection item without iterating entire collection -
I have a class that inherits from CollectionBase. I want to retrieve a particular item without having to iterate over the whole collection. It seems like all the examples I have seen require you to overload the IndexOf which simply iterates through all the items looking for a particular value. I'm thinking there is a quicker way of doing this. If its a REALLY large list, this slow down is unacceptable.
Isn't there a way to immediately jump to a particular item based on a particular field value?
[2005] Retrieve collection item without iterating entire collection -
I have a class that inherits from CollectionBase. I want to retrieve a particular item without having to iterate over the whole collection. It seems like all the examples I have seen require you to overload the IndexOf which simply iterates through all the items looking for a particu
Comparing info in a Collection -
I am currently using a collection to store data about products. I want to compare fields in 2 different collection items, and then sort by which has the greatest number in the collection item that is being compared. For example I have:
Collection Item 1 has a field names matches
[2.0] Object Caching: cache a collection or what -
If I'll retrieve some employee records from the database based on some criteria, should I cache the entire collection or the individual items? I am unsure how to retrieve a cached collection by basing the criteria submitted by the UI/User, I hope you guys could provide me guidance on t
Error in Collection whenever delete one item from collection!!! -
Hii everybody,
I am trying to remove one of the item from the collection, any item not like first or last or in sequence. LIke i have collection of 4 items and i removed 2 second item. After that i am trying to add new with new Key value whcih for this example is 5(In sequence). The
[2008] Removing items from collection without shifting index -
Hi
I have an old school collection that now I need a feature where I can remove an item, however the index can not change, it is very important, so how, if it's even possible can I remove an item but somehow keep the collection from shifting indexes?
I tried setting all the elements
Checking for instance of string in collection -
Hello folks, I'm looking to make my own duplicates remover whichout using others available and am using a collection for this, as a collection I beleive can only hold one of the same item once, if there any method available that can check the current collection for a item already house
adding to a collection -
I'm unfamilar with how to add an item(record) to a collection. I've already established the collection but keep getting errors on the add. My code looks like:
collection.add (
When I put the first ( in place VB opens up this info box listing all my collection elements and their
VB .Net and OOP -
I have recently started using VB .Net as my programming interface and I've come across something that I can't seem to figure out how to do in .Net that I use to use alot in 6.0. I'm a big fan of object oriented programming and using objects and wrappers to store my data so I only have
enumerate collection in RichTextBox -
How do I print the items in my collection in a RichTextBox. If I try to show the items in my collection in debug.print, all the items in my collection show. So I know I have the enumeration part set up correctly. If I try to use the same process in the RichTextBox, it loops through
Moving Collection Items -
I've never used a Collection before and I was wondering how would I go about moving an item from one index to another?
I want to display the item that has an index of 0 and then remove it form the collection at a certain interval. Then I want to move all teh other items up a spot in
adding a collection to an arraylist collection -
for instance, i have a people class and a people collection.
i would like to create a phone collection which consists of
phone class and phone collection and then attach this to the
people class object.
so, in effect, i can call each people item and have the phone collection
Modifying items in a collection -
I have created a public collection to hold some strings (and associated keys) and can add and retrieve item values - but I cant modify the value of existing items in the collection.
For example - I have added a string ("Mars") to the collection using cCollection.add("
Edit/Display/Deleting from a Collection -
Class/collection newbie questions for a homework assignment. Here we go:
1 form (textboxes to accept data and add, edit, display data in the collection)
clsMotor (with defined properties for the class)
clsMotors (collection that contains methods for saving, deleting, editing, disp
Struggle with collections -
Is it possible to know on what index you are in your collection? I work with VB6 but because I'm a straight object oriƫntated [Edited by MartinLiss]I work with classes (yeah right). So I've got a collection of this class. Problem is on a certain moment I want to change the data of one
Collection item exists -
Hi All,
I am trying to write a general function to test if a collection item exists. I have managed to do this for a specific collection, but i would like the function to be able to accept a passed collection.
for example,
itemExists(collection)
would return true or false.
collections and keys query -
i am returning a collection from a class, eg. Test as collection.
within test i add values and keys to the collection, this works fine.
i want to then retrieve the values and the keys. at the moment i can just retrieve the values by the code
with myclass.Test(value1, value2)
Retrieve from Collection using Key -
ok, so you can retrieve items from collections using an ordinal value or key. If you use an int then its ordinal, if you use a string it's a key.
so if i have something stored with a key of 9 and i retrieve with cstr(9) i get the correct item. but if i attempt to retrieve using 1, w
Needs Help With VB6 Collection -
Well, heres what i need to do, its quite simple, actually.
I need to go through each element of a given collection, in a loop. (Probobly For...Each)
But i also need to get the Key of each Collection Item i pass though. Can anyone help me?
collections help please!!! -
What exactly does a collection do?
if i set a new collection in my form
will i be about to use the collection in other forms?
what is a collection of classes are there??
can only show me basics of a collection with examples
add , remove , items etc keywords?
understanding is m
Spanner potential -
Alright I'm prepared for being elevated to 'spannerdom' here.
I've got a class which, amongst other things, will return a collection (Property set/get). I set another collection in the calling form to equal the one in the class (set myFormCol = myClassCol). When I remove an item f
item collection properties -
HI, anybody knows how to make something like this???
collection.item(1).property1=10
I did the collection part, and it works, but I don't know the proerties part.
Thanks!!!
[2005] Datagridview and String Collection -
So I have defined a string collection in My.settings.
I can access the collection by doing my.settins.item("myString")
I also have a datagridview.
What I want to do is to display this information so that extra values can be added/deleted.
So the next logical step
how to maintian index in collection class -
Hii To all,
I have developed collection class that inherites System.Collections.CollectionBase class and used it to store objects of specific class.
This collection class is attached with array of win forms. Collection idex is mtch with winforms array index. In each form activa
Creating a new collection (clearing it) -
Hi,
If I create a collection class with a private collection variable to hold all it's child items, do I need to set each item to "Nothing" before creating a new collection? Like:
Dim errxDelete As Error
For Each errxDelete In mcolErrors
Set errxDelete = Nothing
How To Retrieve Keys from Collection -
If I know the ordinal position of an element in a collection, how can I retrieve the key associated with it?
I want to get the MyCollection.Items(2).Key ... What to do?
Is this possible in VB or with the help of some API?
Collection/Array -
Hello,
Please help me to solve this easy problem (easy to you but not to me).
I have this block(I, II) and name(A, AB). Their combination is 4 and put in a collection. Each item in this collection (i.e. I_A) points to few records. There're many items in each record and one of th
Collection in dll be accessable from other dll. -
Ok, here is what I need. I need to have a dll that will hold a collection of connected sockets. A third party dll needs access to this collection. I have tried this many times before, but whenever I try to access the collection which I tried making static, the thrid party dll just gets
How to find out whether a class with a certain key exists in a collection -
Hi!
I recently ran into this simple problem - I would like to find out whether a class with a certain key exists in a collection (the collection is a class which acts as a repository of CommentStyle onjects in my application).
The way I tried to do this was:
strDummy = MyCollec
Maximum items in a collection -
I got a problem with the collection object in Visual Basic 6.
A maximum of 256 items can be added in a collection. But, if you pass this limit, no more item are add in collection, but the count property continue to expand.
Example:
Dim colTest As New Collection
Dim iCpt As in
Saving info from a collection -
I have a collection made up of two different classes. I can loop through the collection writing all the information out to a text file for each item in the collection but how can I read the information back off the text file and back into a new collection??
If there is a better way
clear a collection -
Hi
I use a collection to count the number of occurence of each item inside my listbox,and I display my results inside labels(control array)but when I click on clear i want to clear all the content of my collection
how can I clear my collection?
[2005] How to make Combo to contain Item Collection -
How to make a ComboBox to contain it's default Item Collection which has been set during design ???
Getting Collection Keys -
Okay.
I have a collection of simple numbers.
each number has a key associating it with a "variable" that is used in several
legacy programs that this monster calls.
I can get to the collection values pretty easily most of this is
currently done by hard-coding the k
Key for items in a Collection -
Hi,
I have a problem.
Removing an item from a collection, and then adding a new object with a Key like the one of the deleted item, I get a message "This key is already associated with an element in this collection (error 457)".
What can I do to be able to reuse the dele
Collection Help -
ok I'm trying to set up a collection to store multiple properties per Item. (e.g. I want it to store partnumber, description, etc in the same collection Item) There will be multiple Items in the collection with the same info. I am trying to distingush between the different items by
Collections and classes -
I have created several class modules called plant and tree. I added the variable data to a collection. How would I also add the variable name to the collection? When retrieving the items from the collection, I need the variable name(object) so I can call its subroutines
Ex. dim
Sorting a custom collection -
How is it possible to sort a custom strongly typed collection by a specific field of an object?
so I have a collection which is of type "Article"
I now want to add article objects to this collection BUT when it adds the item, I want to sort the collection by a specific
Collection question -
Hello-
I've created my own class and collection called Users.
Basically the User Class just has a bunch of property statements and the Collection has your basics... add, remove, count, and item.
What I want to do is something like this:
set objUser = colUsers.Add(rs.field
Collection Sorting -
Is there an easy way to sort a collection other then cloning an item and .Inserting it into the collection at the desired
position and removing the original?
Remove an Item from a collection -
Hi there. I'd really appreciate some help on this. I am checking an arraylist for a value in a collection. If the value is not present then I want to remove the item from the collection. This is the code I am using:
'Check each item against the ArrayList - if not there then remove f