private void BtnIncomeEntrySubmit_Click(object sender, RoutedEventArgs e) { //Check that both the Amount and Type were provided if (TbIncomeAmount.Text == "" | DDLIncomeType.SelectedIndex == 0 | DDLIncomeType.SelectedIndex == -1) { MessageBox.Show("Must provide both an amount and a type"); return; } var amount = TbIncomeAmount.Text.Trim(); //Check the Amount string for validity Regex check = new Regex("^[0-9]+\\.[0-9]{2}$"); if (!check.IsMatch(amount)) { MessageBox.Show("Invalid amount provided. Please provide in format ###.##"); return; } var entry = new Income() { AccountID = Account.ID, Amount = Convert.ToDouble(amount), Type = (IncomeType)Convert.ToInt32(((ComboBoxItem)DDLIncomeType.SelectedItem).Tag), Date = DateTime.Parse(TbIncomeDate.Text), RecordBy = Profile.ProfileName, RecordDate = DateTime.Now }; //Submit the record entry.SubmitRecord(); Account.UpdateAccountBalance(entry.Amount, entry.Date); MessageBox.Show("Income entry submitted"); Common.ReturnToMainWindow(Profile); var main = (MainWindow)Application.Current.MainWindow; if (main.LoadedPage == "Default") { ((DefaultPage)main.PrimaryFrame.Content).RefreshGrid(); } Close(); }