List<object> destList = new List<object>(); foreach (DataGridViewRow row in dataGridView5.SelectedRows) destList.Add(row.DataBoundItem); dataGridView2.DataSource = destList;
foreach (DataGridViewRow row in dataGridView5.Rows) { DataGridViewCheckBoxCell cell = row.Cells[0] as DataGridViewCheckBoxCell; //We don't want a null exception! if (cell.Value != null) { if (Convert.ToBoolean(row.Cells[0].Value)) { destList.Add(row.DataBoundItem); dataGridView2.DataSource = destList; } }
DataSource
foreach
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)