/// <summary>
/// 添加项
/// </summary>
public int AddItems(object value)
{
CheckListBox1.Items.Add(value);
return CheckListBox1.Items.Count;
}
/// <summary>
/// 删除项
/// </summary>
public int RemoveItems(object value)
{
CheckListBox1.Items.Remove(value);
return CheckListBox1.Items.Count;
}
/// <summary>
/// 获取选中IP数组
/// </summary>
/// <returns></returns>
public String[] GetCheckedItem()
{
String[] strCheckedItems = new String[CheckListBox1.CheckedItems.Count];
for (int i = 0; i < CheckListBox1.CheckedItems.Count; i++)
{
if (CheckListBox1.GetItemChecked(i))
{
strCheckedItems[i] = this.chklUpdateItem.GetItemText(chklUpdateItem.Items[i]);
}
}
return strCheckedItems;
}
CheckListBox1.Items.Clear();//清空列表
C#控件CheckListBox的使用
最新推荐文章于 2024-04-05 10:15:20 发布