VB.NET CheckedListBox标签?

CheckedListBox中的项目是否有标记?或类似的东西?我希望能够存储与我正在显示的项目相关联的ID.

解决方法

您可以从CheckedListBox继承自己的控件并创建一个属性,在C#中它就像这样,其余的功能保持不变,因此不需要进一步的额外代码:

public class MyCheckedListbox : System.Windows.Forms.CheckedListBox{
    private object thisObj;
    public object Tag{
       get{ return this.thisObj; }
       set{ this.thisObj = value; }
    }
}

编辑:决定包括VB.NET版本,也为每个人的利益…

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

当然,这很简单,使用拳击,但很好地工作…

希望这可以帮助

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...