5
Answers

How do i capture the checkbox in the checkedListBox control? {NOT RESOLVED}

petre ricardo

petre ricardo

14y
4.2k
1
hi friends, 

i have the followng code that loads a table of Roles to the CheckedListBox: 

        private void Form1_Load(object sender, EventArgs e)
        {
            dt = new DataTable();
            dt.Columns.Add("role_id", typeof(int));
            dt.Columns.Add("role_name", typeof(string));
            dt.Columns.Add("role_descr", typeof(string));

            dt.Rows.Add( new object[] { 1, "Admin", "" } );
            dt.Rows.Add( new object[] { 2, "App User", "" } );
            dt.Rows.Add( new object[] { 3, "Power User", "" } );
            dt.Rows.Add( new object[] { 4, "Maintanence", "" } );
            dt.Rows.Add( new object[] { 5, "Supervior", "" } );
            dt.Rows.Add( new object[] { 6, "Tester", "" } );

            checkedListBox1.DataSource = dt;
            checkedListBox1.DisplayMember = "role_name";
            checkedListBox1.ValueMember = "role_id"; ;
        }



When i check the first item in the CheckedListBox, all the other items must be checked, how do i do that? 

cheers
Answers (5)