private void receiptbtn_Click(object sender, EventArgs e) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "PDF Document File | *.pdf"; dialog.DefaultExt = ".pdf"; if (dialog.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(dialog.FileName, FileMode.Create); fee.GeneratePDF(fs); MessageBox.Show("PDF Generated", "Fee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }