//Button for deleting a child from an account private void btnDeleteChild_Click(object sender, RoutedEventArgs e) { childrenViewModel = new ChildrenViewModel(); objTestViewModel = new TestViewModel(); string strMsg = ""; int convNum = 0; try { int verifyNum; bool isNumerical = int.TryParse(idNum, out verifyNum); if (idNum.Equals("") || isNumerical == false) { strMsg = "Please select a child first before proceeding with the deleting process!"; messageBox(strMsg); } else { convNum = myParentId(idNum); if (convNum <= 0) { strMsg = "Please select a child first before proceeding with the delete process!"; messageBox(strMsg); } else { childrenViewModel.deleteChildRecords(convNum); objTestViewModel.deleteChildTestRecords(convNum); strMsg = "You have successfully deleted: " + name + " from the database!"; messageBox(strMsg); this.Frame.Navigate(typeof(MenuPage), parentId); } } } catch (Exception) { } }