Hi,
Can any one tell me y contain method of ValueListItem does not work. I am trying to find a valuelistitem using
this
.ultraGrid2.DisplayLayout.ValueLists[MyValueList].ValueListItems.Contains(v1) where v1 is ValueListItem but it always gives me false.
While the same works fine if add any new valuelistitem and then try to find it.
ValueListItem.Remove() also works fine but not contain().
Please Help.
Many thanks - this is just what I was after!
Regards
Andrew
Hi Andrew,
That is correct. The Contains method searches the collection for a matching object. In this case, the ValueLists collection does not contain any strings, it only contains ValueList objects, so you will never kind a string that way.
If you are looking for a ValueList whose key is "Test", then what you should do is use the Exists methods, which searches the keys.
Andrew,
Contains checks if the collection has the specified 'ValueList' object. There isn't any overload which takes a string.
Sorry but I don't understand.
If I try to create an object with the same key and then test 'Contains()' it returns false as it is a new object.
Is it possible to send me some example code?
Many thanks for the speedy reply.
Hello Andrew,
Could you please try passing the object itself to the 'Contains()' method and test this again.