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 = MyCollection(MyKey).Property1
If an error occurs, I would return False from the function DoesClassExist(MyKey as variant)
However, the application raises an unhandled error and crashes. I put the error-handling code in the collection class's Item Get property (On Error goto .._Err, Err.Raise err.number), put error handling code into the DoesClassExist function, but still no luck. I can of course iterate through the entire collection to find out whether a key exists, but it sounds to me the performance will quickly degrade with 1000 objects in the collection or more. Can anyone help here?
Thanks a lot in advance,
Stas
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
Determining if an object exists -
I am trying to write code that adds items to a collection. The problem I face is that I need to determine if an item already exists, I don't want to add it again.
Because of the number of items in the collection, I do not want to loop through them all checking each one.
Is there
Collections, classes and New() -
I have a "master" collection and a temporary collection, each is based on a class that I defined. The "master" collection exists as a private form variable. The temporary collection exists in a sub on that form.
In the sub I set my temporary collection equal to t
Can I use the Exists method in VBA -
Hi,
I am trying to find out whether a particular item of the CustomDocumentProperties collection exists.
Using the Exists method does not seem to work.
Any ideas?
Thanks
How do I detect whether a collection item exists -
Hi,
I was just wondering how to detect whether a particular item in a collection exists?
ie. How do I check whether EMS Tools already exists in the following CommandBars collection?
Application.CommandBars("EMS Tools")
Thanks
Chris
How to find out if a collection element exists -
how would I go about figuring out if there's an item in my collection with a certain key?
My program creates collection items with keys "a##" where a is any letter and ## is a number.
now, how would check to see if key "s34" has data?
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.
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
Deleting Duplicates from a collection -
Does anyone have any idea how to delete duplicates from a collection. Or even better a way to check to see if the string exists in the collection before adding it. I have been through all the threads on collections and none seem to explain this problem.
Thanks
Checking if an object exists in a collection -
Hi team
Does anyone know if there is a quick way to check if an object exists in a collection other than checking each one individually?
FW
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
I can't access a collection from a class -
I'm doing an assignment for my VB class where we have to use a module to hold a motor object class and a motor collection class. The collection holds 5 methods like add, find, deleteall, and that sort of thing. For the find one, I need to get a count of all the objects in the collect
eliminating dups -[Resolved by MartinLiss] -
I have a collection of objects that have a value property that is a string data type. Within this collection there may be objects that have values that are duplicated.
I want to create an array of strings that contains distinct values. Currently I am looping through the collection
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
return a collection from a fucntion -
Hi I have a command button when clikced goes to a class module function, which get a collection of all mails in my Inbox.
I need to return the collectoin to myform and be able to access the collection. How do i do it?????
When i do the processin in same Sub it works fine.
But when
Yes another dataset search question -
Hey guys, there has got to be an easy way to do what I'm trying to do and I've done multiple searches on this forum and can't find the exact answer.
I'm using VB.net and oledb to connect to my database and fill my recordset. What I need is some easy way to check and see if a record
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
Collection, container, controls -
Hey there. I'd need professional help =) I'm trying to create a collection with all the controls (mainly textboxes) that I will specify. After this is done, I will loop though the collection and set these controls to .visible = False. That means I need to refer to them.
I tried re
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
Looping thru a collection.... -
Hi All,
I have a problem looping thru a collection. Can anyone please help me out with this......
I have this following code.....
Public mcolContacts As New Collection
Public Sub Add(CustomerID As Long, SiteName As String, ContactName As String)
Dim udtContact As ContactType
How to get values from session objects -
I ahve a collection object saved in the session
I have also declared a new collection object
When I do the following(written from memory )
dim newcoll as new collection
newcoll = Cast(Session("Collection"), Collection)
I get only a reference to the session colle
[2005] Collection, ArrayList or Hashtable -
I am trying to decide which type of collection/array I should use for my current situation. I have a key (which would be an integer, but I don't mind storing it as a string) that is a numer (453278 lets say). And I need to find a corrosponding string (album name) for that number. I am
Java - Two Collections. The same elements or have no elements in common -
Two methods are needed in this case.
Code:
boolean containsAll(Collection<?> c)
boolean disjoint(Collection<?>c1 Collection<?>c2)
Since [i]containsAll(Collection<?> c)[i] is defined within the Collection interface all concrete implementations will be abl
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
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
Query a Dataset or a collection of objects -
I have a collection of objects. I need to check each object against a table to see if they are to be removed from the collection or not. The table is a small one - no more than 20 rows.
I am having a hard time deciding how to proceed with this. I don't want to keep opening a datare
Collection object and Keys -
OK, I have a collection object, which contains many objects of the same type. Each has a key, which is equal to the PK_ID + "K". I am implementing batch processing in my DCOM tier. Now, if I have added a few objects then they won't have a Key since they have not been stored i
.NET collection classes -
So I'm in the middle of upgrading my l33t skillz from VB6, and after working on a study project, I pondered to myself: what is the correct way to do a collection class in .NET?
In VB6, we can just throw a collection in an empty object form, and build it up from there. I see that we
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
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
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
URL File Exists Check -
I have searched everywhere to try and find a way to check if a file exist that is on another webserver.
example i want to check if "http://www.google.com/intl/en/about.html" exists or not. I tried using IO.File.Exists("http://www.google.com/intl/en/about.html") but
Passing VB.net collection to VB6 com dll -
Hi,
I have a VB6 COM DLL that expects a VB6 style collection object as parameter to a method.
It seems like I can not pass a VB.NET created collection.
What do I have to do? I can not make any modifications to the VB6 COM DLL.
The VB6 DLL accesses items in the collection by a
Interrupt Function -
Hi,
I am passing a collection of filenames to my business layer, which then copies the files from the paths specified in the collection to another location while creating entries in the database.
If the file already exists at the new location, is there any way to Interrupt the fu
some stuff i want to know about collections -
is a collection faster than an array?
and wasnt there a find member, or was that in a difrent type of collection...?
Garbage Collection in VB -
Do you have to do garbage collection in VB like you do in C?
Or does VB do automatic garbage collection like Java?
If I must free up the memory used by VB, what are the commands? I did a search for garbage collection in MSDN and got nothing related to VB.
I am assuming some G
Where File Exists -
I want to find out where a particular application like, say, Outlook Express or MS-Word or MS-Excel exists in users' machines i.e. I want to find out the entire physical path of where an application is installed. How do I do it in VB6?
Thanks,
Arpan
[2005] Generics Collection Question -
Right now I have 5 different classes in an Application. In the future I will have alot more.
As of now, when I instantiate one of these Classes, I put the Object in a DataRow Column. The poster JMC told me I needed to make a Strongly Typed Collection instead. I am re-writting thi
need clarity with class collection -
Pls anyone, I need 2 know what is and how I use class collection
My primary goal is to have an array of WithEvents class, which
is impossible. And I searched this forum and from somewhere
I know that I can achieve that by using class collection
Anyone know?
VB6 Collection Classes in C# -
Hi still getting my head round C# ( but it is great) trying to do something I use to use a lot in VB6 that being the Collection Class but have no idea how to achieve this via C# ( it does not even support the collection object unlike VB.Net)
Any help would be appreciated