private void BtnAddNew_Click(object sender, RoutedEventArgs e) { Class classes = (Class)comboBoxClass.SelectedItem; if (txtboxFirstName != null || txtboxLastName != null) { try { DbOperations.AddNewChild(txtboxFirstName.Text, txtboxLastName.Text, int.Parse(txtboxAge.Text), classes.Id); ClearTextbox(); Updatelists(); UpdatedMessage(); } catch (PostgresException ex) { MessageBox.Show(ex.Message); } } }