I am creating a custom control that inherits from ComboBox. I need to detect when a Item is added to the ComboBox to perform my own checks. It doesn't matter if it's C# or Vb.NET, but I don't know how to do it.
I tried all the things I found across the internet, including this thread, but the link in the answer is offline and I didn't manage to guess what should I do.
For example, this code in Vb.net:
Public Sub SomeFunc() Handles Items.CollectionChanged
'....
End Sub
It says that Items
property is not defined WithEvents
.
The control is not using a BindingSource. I need the control to perform a custom action when an Item is added. Items are added directly into the .Items
property with:
customComboBox.Items.Add("item");
Can it be done?