Как я могу кодировать множественный выбор в DataGridView CheckBox в C#? - PullRequest
0 голосов
/ 17 марта 2020
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
    {


        if (!(Convert.ToBoolean(dataGridView1.CurrentRow.Cells[0].Value)))
        {
            //Uncheck all options first, then assign corresponding dataset name
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                row.Cells[0].Value = false;
            }
            //check selected row and assign corresponding dataset name
            dataGridView1.CurrentRow.Cells[0].Value = true;
            //Collection<string> id = new Collection<string>();

            id = (String)dataGridView1.CurrentRow.Cells[1].Value;
        }
        else
        {
            //uncheck selected row and assign 'null' as dataset name
            dataGridView1.CurrentRow.Cells[0].Value = false;
            id = null;
            return;
        }

Я хочу, чтобы флажок выбрал более одного. Кто-нибудь может мне помочь?

...