第2个回答 推荐于2018-05-10
/// <summary>
/// C#中获取CheckListBox选中项的值。
/// </summary>
/// <param name="clb">要被获取选中项的CheckListBox类型的对象。</param>
/// <returns>返回一个ArrayList类型的对象。</returns>
private ArrayList GetCheckedItemsText(CheckedListBox clb)
{
ArrayList result = new ArrayList();
IEnumerator myEnumerator = clb.CheckedIndices.GetEnumerator();
int index;
while (myEnumerator.MoveNext())
{
index = (int)myEnumerator.Current;
clb.SelectedItem = clb.Items[index];
result.Add(clb.Text);
}
return result; }
或者 你可以使用遍历
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
if (checkedListBox1.GetItemChecked(i))
{
MessageBox.Show(checkedListBox1.GetItemText(checkedListBox1.Items[i])); //弹出选中值
}
}本回答被网友采纳