o
k
q
u
e
s
t
i
o
n
s
.
c
o
m

Retreive Collection item using key gives error -

Hi
I am doing

MileageReport(i).collCabs.Item(CStr(uniqCabIds(j)))

where collcabs is a collection that has entries based on keyvalue, uniqCabIds and MileageReport are arrays.
The references to the two arrays are legal , but the search for an item in collCabs based on key should result in Nothing being returned sincve the element does not exist with that key. Unfortunately I get a Invalid procedure call or argument Error on this line.

Is there a way to detect if an entry exists for a given key in the collection?

As a note, I put in a error handler just before that line but that seems to be getting ignored.

Pls help quick!
Thanks

 

Retreive Collection item using key gives error -
Hi I am doing MileageReport(i).collCabs.Item(CStr(uniqCabIds(j))) where collcabs is a collection that has entries based on keyvalue, uniqCabIds and MileageReport are arrays. The references to the two arrays are legal , but the search for an item in collCabs based on key should


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


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


Retreiving value or listindex -
how can i retreive either the value(item) or listIndex in listbox? -i know how to retreive a selected item... i want to know how to retreive all listIndex or value in multiple selected item thanks guyz in advance


[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


Removing Items from a collection -
Can anyone give me any examples of how they would remove several items from a collection without getting a "subscript out of range " error. I have a collection of maybe 60 items and most of them due to validation will be removed leaving me with around twenty, the thing is


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


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.


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


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


Are item values in collection read-only -
Hi! I have two problems. The first one is that when I try to assign a value to an item for a collection, an error is returned dim col1 as collection set col1 = new collection col1.Add 1, "first" col1.Add 2, "second" col1("first") = 3 ' error


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("


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


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


[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


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 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


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


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


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!!!


check if a special item is member of a collection -
There is a collection packed with items. each item under its specific key. when I want to find out if a special item is member of the collection, I try something like this: IF myCollection.Item(KeyInQuestioin) is nothing THEN msgbox "there is no item to find by KeyInQuestion


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


Collections and keys -
I am using a collection and adding items using a string key. Later in my code I am using the Item method to pull objects out by their key. Sometimes, however, the Item might not be there. Is there a polite way to ask a collection if an item with this key is in the collection. At the


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


Possible to set a LIstbox.Datasource to a collection -
I'm trying to set the datasource value of a listbox to a strongly-typed collection. .DataSource = myVehicleCollection .ValueMember = "Item" .DisplayMember = "ToString" The Item property in my collection returns a single vehicle. On load of the form, I ke


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


Item cannot be found in the collection corresponding to the requested name or ordinal -
After adding this property to my connection: cn.Properties("Jet OLEDBatabase Locking Mode") = 1 I get this error when I open the connection: Item cannot be found in the collection corresponding to the requested name or ordinal. Every search I've done discusses thi


VB Collection help -
I need to compare wether a collection item at index (n) is = nothing...for validation purposes. If myColl.Item(n) = Nothing Then except that this gives me an error...I can't seem to find enough specifc material on collections being compared to nulls to find out if that index e


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


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


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?


Getting a Collection item from one Collection to another -
Hi, Okay, I've spent 2 days trying to figure this out. I'm obviously missing something because it seems it should be easy . I have 2 Collections and want to get an item from one to the other. I have a function for adding an item and tried to write a function for getting an item


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


ItemExist in Collection [Resloved] -
Hi, Is there any way i can check if an Item in a Collection object already exist before adding it. Say i have a collection called MyColl i added an item MyColl.add myobj, "key1" now is there way i can find out if an item with the "key1" key name already


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


Passing item of a collection by val -
Hi all, How can i pass item of a collectiion by val. For e.g. Dim cola As Collection Dim colb As Collection Set cola = New Collection Set colb = New Collection Dim rstA As ADODB.Recordset Set rstA = New ADODB.Recordset rstA.Fields.Append "Nm", adChar, 10 r


3625 : Item not found in this collection... -
Set UserDB = DBEngine.Workspaces(1).OpenDatabase(App.Path + "Users.mdb") In the above code, I get the error "Item not found in collection." Now, I have used this same code with different databases several times. I have done the exact same with this as I have with


3625 : Item not found in collection... -
Set UserDB = DBEngine.Workspaces(1).OpenDatabase(App.Path + "Users.mdb") In the above code, I get the error "Item not found in collection." Now, I have used this same code with different databases several times. I have done the exact same with this as I have with


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


how to retreive from datagrid -
hi, is there any possible to retreive the records in the datagrid and display in textbox? ie i am selecting one row and that row has 2 feilds and i created two textboxes in my form for displaying that feild from datagrid while clicking retreive button, i need coding for that