checkedlistbox but just pass me the last one to the datagridview

1

Good afternoon I am trying to pass the captured data of checkedlistbox but only pass me the last one to datagridview

In DataGridView just attach the database with datasource .

and this is my registration code

private void btnRegistrar_Click_1(object sender, EventArgs e)
{
     try
     {
          contexto = new checkListdbEntities3();

          rchecklist rchecklist = new rchecklist()
          {
               IDObra = int.Parse(txtid.Text),
               Obra=txtObra.Text,
               check=clbCheck.Text,
               Notas=txtnotas.Text,
               Novivienda=txtvivienda.Text,
               Residente=txtResidente.Text,
          };

          contexto.rchecklists.Add(rchecklist);
          contexto.SaveChanges();
          MessageBox.Show("Agregado Correctamente");
     }
     catch (Exception ex)
     {
          MessageBox.Show("Ocurrio un Error no se registro ticket:" + ex.ToString());
     }
}

Here I do not have any problem just that when I select the options of checkedlistbox it does not happen to me all only the last one.

    
asked by Julio Rosas 26.04.2018 в 18:24
source

0 answers