Exemplo n.º 1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            AddEditVehicle aev = new AddEditVehicle();

            aev.MdiParent = this.MdiParent;
            aev.Show();
        }
Exemplo n.º 2
0
        private void btn_Edit_Click(object sender, EventArgs e)
        {
            if (dgv_VehicleList.SelectedRows.Count != 0)
            {
                var id  = (int)dgv_VehicleList.SelectedRows[0].Cells["Id"].Value;
                var car = _db.Cars.FirstOrDefault(x => x.Id == id);


                AddEditVehicle aev = new AddEditVehicle(car);
                aev.MdiParent = this.MdiParent;
                aev.Show();
            }
            else
            {
                MessageBox.Show("Select any row before click Edit button");
            }
        }