title: Saving source code formatting to TXT file
body: <p>I am trying to extract the source code from a webpage and save it to a text file. However, I want to keep the formatting of the source code. </p>
  
  <p>My code is below.</p>
  
  <pre><code>// this block fetches the source code from the URL entered.
          private void buttonFetch_Click(object sender, EventArgs e)
          {
              using (WebClient webClient = new WebClient())
              {
                  string s = webClient.DownloadString("http://www.ebay.com");
  
                  Clipboard.SetText(s, TextDataFormat.Text);
  
                  string[] lines = { s };
                  System.IO.File.WriteAllLines(@"C:\Users\user\Dropbox\Personal Projects\WriteLines.txt", lines);
  
                  MessageBox.Show(s.ToString(), "Source code",
                  MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
              }
          }
  </code></pre>
  
  <p>I would like the text file to show the source code as it is formatted in the Messagebox.</p>
  
  <p>Messagebox screenshot:
  <img src="https://i.stack.imgur.com/6Aayn.jpg" alt="enter image description here"></p>
  
  <p>Text file screenshot:
  <img src="https://i.stack.imgur.com/HsM7f.jpg" alt="enter image description here"></p>
  
  <p>How would I go about getting the text document's formatting to be the same as in the Messagebox?</p>