private void pictureBox2_Click(object sender, EventArgs e) { this.Close(); TaskSer tSer = new TaskSer(); int noOfTaskSimilar = tSer.GetNoOfTaskOfRepeatID(obj.RepeatDateTask_ID); if (noOfTaskSimilar > 1) { if (MessageBox.Show("Are you want to delete all task which is following this task.", "Hello", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { tSer.DeleteByRepeatID(obj.RepeatDateTask_ID); } else { tSer.Delete(obj.Task_ID); } } else { tSer.Delete(obj.Task_ID); } MessageBox.Show("Task Is Deleted"); UserControlForOnlyTestPurpose.uC.LoadTaskList(); }