private void SelAllB_Click(object sender, EventArgs e) { if (SelAllB.Text.ToLower() == "select all") { for (int x = 0; x < ChooseContactsCLB.Items.Count; x++) { ChooseContactsCLB.SetItemCheckState(x, CheckState.Checked); } SelAllB.Text = "Deselect All"; return; } if (SelAllB.Text.ToLower() == "deselect all") { for (int x = 0; x < ChooseContactsCLB.Items.Count; x++) { ChooseContactsCLB.SetItemCheckState(x, CheckState.Unchecked); } SelAllB.Text = "Select All"; } }
private void SendMessage_Load(object sender, EventArgs e) { foreach (string str in GlobalVar.GlobalDeptArr) { if (str != "") { ChooseContactsCLB.Items.Add(str); } } for (int i = 0; i < ChooseContactsCLB.Items.Count; i++) { ChooseContactsCLB.SetItemChecked(i, false); } if (ChooseContactsCLB.Items.Count > 0) { button1.Enabled = true; } SelAllB.Text = "Select All"; }