第一次使用checkedListBox,在VS2005裡面沒有智能提示其含有DataSource的屬性,事實上,它有。
DataTable dt = ds.Tables[0];
checkedListBox_Issue.DataSource = dt;
checkedListBox_Issue.ValueMember = "ID";
checkedListBox_Issue.DisplayMember = "LoginID";
/// <summary>
/// 全選或者全不選
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void checkBox_All_CheckedChanged(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBox_Issue.Items.Count; i++)
{
checkedListBox_Issue.SetItemChecked(i,checkBox_All.Checked);
}
}