I'm using VB.NET, and I have tried to remove the WinCombo ItemNotInList event using the VB.NET RemoveHandler statement. However, when I do that, my form validation fails when using ValidateChildren(). If I remove the RemoveHandler then the form passes validation just fine.
I tried using the EventHandlerDictionary method to remove the event, but couldn't get the right syntax. I kept getting a compile error from the method saying "expression does not return a value".
While typing this I was also testing: it looks like the issue is caused by the e.RetainFocus property of the ValidationErrorEventArgs class. If I leave the event hooked up, and set RetainFocus = False, validation passes. If I set it to True (the default) it causes validation to fail. Note that ValidateChildren() causes this event to fire. So it looks like the VB RemoveHandler DID remove the event, but the RetainFocus is left set to the default value of True which causes validation to fail.
As far as I know, there is NO way besides within the ItemNotInList event to set this property. Is that true?? My solution was to check some member flags, and if ok set RetainFocus=False. This seems like a hack.
Please advise. Thanks.
Yes, that worked as I outlined in my previous post. Thank you.
Hi
I just wanted to know if you war able to set LimitToList to false and validate the Items correctly or you still need help? Just let me know. Thank you.
Sincerely,DimiDeveloper Support EngineerInfragistics, Inc.
You could set the control's LimitToList property to false prior to calling ValidateChildren.
Found the solution: after RE-reading the docs, the trick is to set the WinCombo LimitToList prop to False in conjuntion with removing the event. This way, the RetainFocus prop will be set to False by default via the LimitToList set to False. If LimitToList is set to True which means RetainFocus is now set to True, then the built in Validation (Validating events) fails even if the ItemNotInList event is unhooked.