private void button1_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.Items.Count; i++) { string s = (string)checkedListBox1.Items[i]; string[] res = s.Split('.'); int id; int.TryParse(res[0], out id); if (checkedListBox1.GetItemCheckState(i) == CheckState.Checked) { ctrll.addListener(loggedUser.Username, id); } } MessageBox.Show("Submit was succesful!"); }