What I do is get a row from another datagridview1 just send it to call the list of the other datagridview2 and place it in the datagridview1. What I want to do is get only one row from the list, not all the data. I'm working with 3 layers. this would be my code of the form where I want to send the row datagridview2
O I WANTED TO KNOW IF THERE IS ANOTHER WAY TO SEND CALLING ROWS
private void FrmBuscarProducto_Load(object sender, EventArgs e)
{
try
{
Nproducto gestionproductos = new Nproducto();
dataGridView1.DataSource = gestionproductos.obtenerlistproducto();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "ERROR");
}
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
try
{
idproducto = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["id_producto"].Value.ToString());
costo = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells["precio_ventas"].Value.ToString());
tipo = dataGridView1.Rows[e.RowIndex].Cells["tipo"].Value.ToString();
nombre = dataGridView1.Rows[e.RowIndex].Cells["nombre"].Value.ToString();
cantidad = dataGridView1.Rows[e.RowIndex].Cells["cantidad"].Value.ToString();
descripcion = dataGridView1.Rows[e.RowIndex].Cells["descripcion"].Value.ToString();
DialogResult = DialogResult.OK;
}
catch (Exception ex)
{
throw ex;
}
}
AND THIS WOULD BE THE CODE OF MY BUTTON WHERE I WILL ADD THE ROW
private void btnagregar_Click(object sender, EventArgs e)
{
FrmBuscarProducto bp = new FrmBuscarProducto();
if (bp.ShowDialog() == DialogResult.OK)
{
Nproducto gestionproductos = new Nproducto();
dgvventas.DataSource = gestionproductos.obtenerlistproducto();
}
}