3
How to add a Checkbox column in Datagridview ?
I need to do this for the user to select the Datagridview line with the Checkbox and then click the Save button.
private void btnRestricao_Click_2(object sender, EventArgs e)
        {
            OleDbDataReader dr = null;
            try
            {
                this.pnlModalMotivo.Visible = true;
                dr = MotivoNegocio.ListarMotivo();
                for (int i = 0; i < dr.FieldCount; i++)
                {
                    DataGridViewColumn coluna = new DataGridViewTextBoxColumn();
                    coluna.HeaderText = dr.GetName(i);
                    coluna.Visible = true;
                    coluna.Name = "coluna" + 1;
                    coluna.Resizable = DataGridViewTriState.True;
                    dgvMotivo.Columns.Add(coluna);
                }
                while (dr.Read())
                {
                    object[] campos = new object[dr.FieldCount];
                    for (int i = 0; i < dr.FieldCount; i++)
                        campos[i] = dr.GetValue(i);
                    dgvMotivo.Rows.Add(campos);
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message);
            }
        }
						
