When I search an Item in a collection and the item does not exist I get en error instead of "nothing" !?
Don't tell me that that's the way it works - this would be just stupid. Or am I doing any mistake? I do
Dim MyCollection as new collection
MyCollection.add("something","myIndex")
MyCollection.Item("xxx")
This gives an error : The argument 'index' isn't a valid value.
Thank you for any help!
Regards,
Fabian
What I finally did is to create a function that sends back "nothing" instead of throwing an error...
VB Code:
Public Function SearchCollectionItem(ByVal Collection As Collection, ByVal Index As String) As Object Try Return Collection.Item(Index) Catch ex As Exception Return Nothing End Try End Function




Reply With Quote