You can inherit your own control from CheckedListBox and create a property, in C # it will be like that, the rest of the functions will remain the same as they are inherited, therefore additional additional code is not required:
public class MyCheckedListbox: System.Windows.Forms.CheckedListBox {
private object thisObj;
public object Tag {
get {return this.thisObj; }
set {this.thisObj = value; }
}
}
Edit: Decided to include a version of VB.NET for all who benefit ...
Public Class MyCheckedListBox Inherits System.Windows.Forms.CheckedListBox
Private thisObj As Object
Public Property Tag As Object
Get
Tag = thisObj
End get
Set (objParam As Object)
thisObj = objParam
End set
End property
End class
Of course, this is understandable and uses boxing, but it works great ...
Hope this helps
source share