|
-
Feb 2nd, 2000, 08:31 AM
#1
Thread Starter
Junior Member
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
Dim key As String
With udtContact
.CustomerID = CustomerID
.SiteName = SiteName
.ContactName = ContactName
.Selected = False
End With
key = "CID:" & CustomerID
End Sub
Now I have 2 conditions
1)I want to remove the item if it already exists and add the same item with the updated value OR
2)Add a new item if it is not present in the collection.
The code for this is code is as follows
if key exists then
mcolContacts.Remove key mcolContacts.Add udtContact, key
Else
mcolContacts.Add udtContact, CStr(key) End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|