I am using VB .NET 1.1 and wanted to make sure if inside a key value pair class “Dates” (collection type) a key by name “TerminationDate” exists.
If Not Dates.Item("TerminationDate") Is Nothing Then
'Do x y z'
End if
But this is throwing an exception:
Argument Index is not a valid value.
I am very new to VB.
Thanks
As you saw, the
Containsmethod was added in the 2.0 Framework so you can’t use it. As far as I can tell, there is no way within the 1.1 Framework to look for the existence of a given key. The only way to do this is to try getting the item at that key and swallowing the exception if its not found. This helper method will do that:To use it: