I have two DataGridView
in this way:
What I need is that the CheckBox
that are selected from the first DatagridView
when pressing the Button
"add" are passed to the second DataGridView
.NOTA: The total
of the second DataGridView
I will calculate it from column cantidad
and precio
(which is hidden).
I really already try in some ways with the little knowledge I have, but I think I am far from getting it, so I hope you can help me thanks.
foreach (DataGridViewRow row in dgvInsumo.Rows)
{
try
{
if (Convert.ToBoolean(row.Cells[1].Value))
{
foreach (DataGridViewRow row2 in dgvInsumosAgregados.Rows)
{
dgvInsumosAgregados[0, row2.Index].Value = dgvInsumo[0, row.Index].Value;
dgvInsumosAgregados[1, row2.Index].Value = dgvInsumo[2, row.Index].Value;
dgvInsumosAgregados[2, row2.Index].Value = dgvInsumo[3, row.Index].Value;
dgvInsumosAgregados[3, row2.Index].Value = dgvInsumo[4, row.Index].Value;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Sistema Restaurante", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
This was the last way I tried, the most likely thing is that it's very bad.
Thank you already shows me something at least but it does it this way:
Probably because the columns of both DataGridView
are not in the same order or with the same name.