private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var carSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as DataGridView.QuerysInnerJoinDataSet1.CarrosRow; //caso switch (e.ColumnIndex) { //coluna que ele clicar caso o deletar case 0: { this.carrosTableAdapter1.DeleteQuery(carSelect.Id); } break; case 1: { fmEdicaoCarros editCarro = new fmEdicaoCarros(); editCarro.CarrosRow = carSelect; editCarro.ShowDialog(); this.carrosTableAdapter1.Update(editCarro.CarrosRow); /* * editCarro.CarrosRow.Modelo, * editCarro.CarrosRow.Ano.ToString(), * editCarro.CarrosRow.Marca, * editCarro.CarrosRow.UsuInc, * DateTime.Now, * editCarro.CarrosRow.Id);*/ } break; } this.carrosTableAdapter1.CustomQuery(this.querysInnerJoinDataSet1.Carros); }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var vendasSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as DataGridView.QuerysInnerJoinDataSet1.VendasRow; fmEdicaoCarros editCarro = new fmEdicaoCarros(); //editCarro.CarrosRow = vendasSelect; //editCarro.ShowDialog(); this.vendasTableAdapter.Update(editCarro.CarrosRow); this.vendasTableAdapter.DeleteQuery(vendasSelect.Id); this.vendasTableAdapter.CustomQuery(this.querysInnerJoinDataSet1.Vendas); }