c# - Saving source code formatting to TXT file -


i trying extract source code webpage , save text file. however, want keep formatting of source code.

my code below.

// block fetches source code 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);             }         } 

i text file show source code formatted in messagebox.

messagebox screenshot: enter image description here

text file screenshot: enter image description here

how go getting text document's formatting same in messagebox?

i agree comment, i'll add note. if open in notepad++, n++ detect line endings , display file nicely you. in notepad++ can go menu , change line endings windows. if re-save , open in notepad itself, correctly. problem base notepad doesn't understand different line endings.

hope helps.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -