Beispiel #1
0
        private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //var carSelect = ((System.Windows.Forms.DataGridViewRow)((((System.Windows.Forms.DataGridView)sender).Rows).Items[0])).DataBoundItem
            var carSelect = ((System.Data.DataRowView)
                             this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row
                            as DataGridView.ExerciciosFinaisDataSet1.CarrosRow;

            switch (e.ColumnIndex)
            {
            case 0:
            {
                this.carrosTableAdapter.DeleteQuery(carSelect.Id);
                this.carrosTableAdapter.customQuery(exerciciosFinaisDataSet1.Carros);
            }
            break;

            case 1: {
                frmEdicaoCarros editCarro = new frmEdicaoCarros()
                {
                    CarrosRow = carSelect
                };
                editCarro.ShowDialog();

                this.carrosTableAdapter.Update(editCarro.CarrosRow);
            } break;
            }
            this.carrosTableAdapter.customQuery(this.exerciciosFinaisDataSet1.Carros);
        }
Beispiel #2
0
        private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var carSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row
                            as DataGridView.QuerysInnerJoinDataSet1.CarrosRow;

            this.carrosTableAdapter.DeleteQuery(carSelect.Id);
            this.carrosTableAdapter.CustomQuery(this.querysInnerJoinDataSet1.Carros);

            switch (e.ColumnIndex)
            {
            case 0:
            {
                this.carrosTableAdapter.DeleteQuery(carSelect.Id);
            }
            break;

            case 1:
            {
                frmEdicaoCarros editCarro = new frmEdicaoCarros();
                editCarro.ShowDialog();
            }
            break;
            }

            this.carrosTableAdapter.Fill(this.querysInnerJoinDataSet1.Carros);
        }