Note that there are some explanatory texts on larger screens.

plurals
  1. POSave As PDF File Button C#
    text
    copied!<p>Hello guys I'm running a testing program for saving files &amp; I'm facing a problem in saving rich text boxes as pdf files 'cause each time I save a file Adobe Reader can't open it, and here's my code:</p> <pre><code>private void button3_Click(object sender, EventArgs e) { SaveFileDialog MyFiles = new SaveFileDialog(); MyFiles.Filter = "PDF Files|*.pdf"; MyFiles.Title = "Save As..."; MyFiles.DefaultExt = "*.pdf"; if (MyFiles.ShowDialog() == DialogResult.OK) { richTextBox1.SaveFile(MyFiles.FileName, RichTextBoxStreamType.PlainText); richTextBox3.SaveFile(MyFiles.FileName, RichTextBoxStreamType.PlainText); richTextBox4.SaveFile(MyFiles.FileName, RichTextBoxStreamType.PlainText); richTextBox5.SaveFile(MyFiles.FileName, RichTextBoxStreamType.PlainText); } } </code></pre> <hr> <p>hi guys I made also a send button to send an email with attachments but the problem is I'm unable to send the email: </p> <pre><code> MailMessage MyMail = new MailMessage(richTextBox1.Text, richTextBox4.Text); MyMail.To.Add(new MailAddress(richTextBox4.Text)); MailAddress mail = new MailAddress(richTextBox1.Text); MyMail.From = mail; MyMail.Subject = richTextBox5.Text; MyMail.Body = richTextBox3.Text; MyMail.Attachments.Add(new Attachment(richTextBox2.Text)); SmtpClient MySmtp = new SmtpClient(TheServer.Text); MySmtp.UseDefaultCredentials = true; MySmtp.EnableSsl = true; MySmtp.Port = Convert.ToInt32(ThePort.Text); MySmtp.Send(MyMail); </code></pre> <p>So what's the wrong with this code? your help will be appreciated>>> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload