private void mnuTrophiesWonBySailNumber_Click(object sender, EventArgs e) { try { using (ReportCreator report = new ReportCreator()) { FileInfo fi = report.GenerateWinnerReport((string)mnuTrophiesWonBySailNumber.Tag); System.Diagnostics.Process.Start(fi.FullName); } } catch (IOException ex) { MessageBox.Show(this, string.Format("A problem occurred generating the report:\n{0}", ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.ComponentModel.Win32Exception ex) { MessageBox.Show(this, string.Format("The PDF couldn't be opened:\n{0}", ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CreateReport(int trophyID) { try { using (ReportCreator report = new ReportCreator()) { FileInfo fi = report.GenerateTrophyReport(trophyID); System.Diagnostics.Process.Start(fi.FullName); } } catch (IOException ex) { MessageBox.Show(this, string.Format("A problem occurred generating the report:\n{0}", ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.ComponentModel.Win32Exception ex) { MessageBox.Show(this, string.Format("The PDF couldn't be opened:\n{0}", ex.Message), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }