private void button4_Click(object sender, EventArgs e) { if (textBox3.Text != "") { Data.CarID = textBox3.Text.Trim(); carsAll cars = new carsAll(); cars.MdiParent = main.ActiveForm; cars.Show(); cars.carsSearchId(Data.CarID); } else if (textBox4.Text != "") { Data.CarVIN = textBox4.Text.Trim(); carsAll cars = new carsAll(); cars.MdiParent = main.ActiveForm; cars.Show(); cars.carsSearchVIN(Data.CarVIN); } else { MessageBox.Show("You need to enter Car's Id or Car's Last VIN"); return; } }
private void textBox4_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { try { if (textBox4.Text != "") { Data.CarVIN = textBox4.Text.Trim(); carsAll cars = new carsAll(); cars.MdiParent = main.ActiveForm; cars.Show(); cars.carsSearchVIN(Data.CarVIN); } else { MessageBox.Show("You need to enter Car's VIN"); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }