getting website text

this code gets the pastebin text and puts it in a textbox. how can i make it read line by line instead of reading it all?
if i were to make my pastebin like this:
"1
2"
it reads it as "12"
i want it to read it as just 1

1
2
3
4
5
6
  using namespace System::Net;
  WebClient web;
  private: System::Void button1_Click(System::Object^  sender, 
System::EventArgs^  e) {
    textBox1->Text = web.DownloadString("http://pastebin.com/raw.php?i=fPf1NBWB");
  }
Consider posting this in the Windows forum, given that you're not asking about standard C++.
Reading it line by line is more complicated. Consider slitting the string instead.
what if i were to get the text from a notepad then get the text from the notepad? would that be easier to make it read line by line?
also if that's still complicated, how do i slit the string?
Slitting a string is the easiest.
1
2
3
4
5
6
7
8
9
10
11
System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
    {
      WebClient web;
      String^ buffer = web.DownloadString("http://www.cplusplus.com/forum/beginner/230330/");
      String^ sep = "\r\n";
      array<String^> ^lines = buffer->Split(sep->ToCharArray());
      if (lines->Length > 0)
        textBox1->Text = lines[0];
      else
        MessageBox::Show("Text empty");
    }
ohhh i didn't know it was that simple. thanks a lot!
Yes .NET makes many things very simple.

BTW. It might not work with all websites. Many websites are compressed so the whole text is in one gigantic line.
Topic archived. No new replies allowed.