private void AddCarSubmit_Click(object sender, RoutedEventArgs e) { string[] Data = new string[6]; Data[0] = VINText.GetLineText(0); Data[1] = ModelText.GetLineText(0); Data[2] = YearText.GetLineText(0); Data[3] = ManufacturerText.GetLineText(0); Data[4] = SeatsText.GetLineText(0); Data[5] = PriceText.GetLineText(0); string Type = TypeText.GetLineText(0); string VIN = Data[0]; MakeVehicle V = new MakeVehicle(Data, cn); MakeCar C = new MakeCar(VIN, Type, cn); try { V.CreateVehicle(); } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } try { C.CreateCar(); } catch (OleDbException ex) { try { V.DeleteVehicle(); } catch (OleDbException ex2) { } ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); return; } if (used) { R = new VehicleHistoryReport(Parent, cn); R.ShowDialog(); } this.Close(); }