private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.ColumnIndex == colstatus.Index) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; yiyilandbDataSet.productsRow switchrow = ((DataRowView)row.DataBoundItem).Row as yiyilandbDataSet.productsRow; yiyilandbDataSet1.products.ImportRow(switchrow); yiyilandbDataSet.products.RemoveproductsRow(switchrow); } }
private void btnRemove_Click(object sender, EventArgs e) { try { List <yiyilandbDataSet.productsRow> lst = new List <yiyilandbDataSet.productsRow>(); foreach (DataGridViewRow row in dataGridView2.Rows) { if ((bool)row.Cells[0].Value) { yiyilandbDataSet.productsRow switchrow = ((DataRowView)row.DataBoundItem).Row as yiyilandbDataSet.productsRow; yiyilandbDataSet.products.ImportRow(switchrow); yiyilandbDataSet1.products.RemoveproductsRow(switchrow); } } } catch (Exception ex) { } }