コード例 #1
0
ファイル: Form1.cs プロジェクト: hardhill/GibddFouls
        private void bNewCar_Click(object sender, EventArgs e)
        {
            FormCar formCar = new FormCar();

            formCar.txtCarname.Text = "";
            formCar.txtCaryear.Text = "";
            formCar.IdCar           = 0;
            if (formCar.ShowDialog() == DialogResult.OK)
            {
                dbContext.NewCar(formCar.txtCarname.Text, formCar.txtCaryear.Text);
                UpdateListCars(txtFindCar.Text);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: hardhill/GibddFouls
        private void listBoxCar_DoubleClick(object sender, EventArgs e)
        {
            Car     car     = (Car)listBoxCar.SelectedItem;
            FormCar formCar = new FormCar();

            formCar.txtCarname.Text = car.Carname;
            formCar.txtCaryear.Text = car.Caryear;
            formCar.IdCar           = car.IdCar;
            if (formCar.ShowDialog() == DialogResult.OK)
            {
                car.Carname = formCar.txtCarname.Text;
                car.Caryear = formCar.txtCaryear.Text;
                dbContext.UpdateCar(car);
                listBoxCar.Items[listBoxCar.SelectedIndex] = car;
            }
            UpdateListCars(txtFindCar.Text);
        }