/// <summary> /// Create a text file containing formatted output /// </summary> /// <param name="iDisp">an object of type IDisplay</param> public void GenerateTextReport(IDisplay iDisp) { string filename = ""; if (iDisp == null) { MessageBox.Show("First select the item to be sent to the report file", "No item selected"); } else { if (iDisp is Applicant) { Applicant a = (Applicant)iDisp; filename = a.RegNo; } else if (iDisp is ForceService) { ForceService s = (ForceService)iDisp; filename = s.FSNo; } else if (iDisp is ApplicantList) { filename = AppData.Applicants; } else { filename = AppData.ForceServices; } textReportGenerator.GenerateReport(iDisp, filename + ".txt"); MessageBox.Show("Text report " + filename + ".txt" + " created."); } }