private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { MachineController controller = new MachineController(); Machine newMachine = controller.FindSpecificMachine(Convert.ToInt32(comboBox.SelectedValue)); machine = newMachine; comboBoxYear.ItemsSource = controller.GetListForComboBoxYear(newMachine.Lifespan); //Sæt maxværdi på valgt år box til lifespan }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { MachineController controller = new MachineController(); Machine newMachine = controller.FindSpecificMachine(Convert.ToInt32(comboBox.SelectedValue)); txtBoxMachineName.Text = newMachine.Name; txtBoxLifespan.Text = newMachine.Lifespan.ToString(); txtBoxScrapValue.Text = newMachine.ScrapValue.ToString(); txtBoxPurchasePrice.Text = newMachine.PurchasePrice.ToString(); if (newMachine.ProductionUse) { radioBtnYesMachine.IsChecked = true; } else { radioBtnNoMachine.IsChecked = true; } DTPickerpurchaseDate.SelectedDate = newMachine.DateBought; txtBoxInterestRate.Text = newMachine.InterestRate.ToString(); }