I have a datagridview1 that searches the database for the data and shows the information, I want it to click the add button it picks the selected row in the first datagridview1 and passes it to another datagridview2.
I just put an example List<string>
, but the idea is this:
List<string> Selecionados = new List<string>();
private void buttonAdicionar_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count >0)
{
string item = dataGridView1.SelectedRows[0].Cells["ColunaItem"].Value.ToString();
//Adiciona outras propriedades, quantidades, etc...
Selecionados.Add(item);
//update no dataGridView2
}
}