private void Btn_DeleteQuestion(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(QuestionIdTextBox.Text)) { MessageBox.Show("Id field is empty"); return; } var teacher = new TeacherBll(); if (teacher.DeleteQuestionById(int.Parse(QuestionIdTextBox.Text))) { QStatemenTextBox.Text = ""; OptionATextBox.Text = ""; OptionBTextBox.Text = ""; OptionCTextBox.Text = ""; OptionDTextBox.Text = ""; OptionBox.Text = ""; MessageBox.Show("Question deleted"); myQuestion = null; } else { MessageBox.Show("Something went wrong,Question already deleted or Does not exist"); } }