public void idCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { string id = NannyIDComboBox.SelectedValue.ToString(); nanny = this.bl.GetNannyByID(id); MessageBox.Show(nanny.ToString()); } catch (FormatException) { MessageBox.Show("Incorrect input"); } catch (Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// display the selected nanny details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void moreDataGridButton_Click(object sender, RoutedEventArgs e) { try { if (this.NannyDataGrid.SelectedItem is BE.Nanny) { nanny = (BE.Nanny) this.NannyDataGrid.SelectedItem; MessageBox.Show( nanny.ToString(), $"{nanny.FirstName} {nanny.LastName} Details"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }