0

My program won't display all the text on a webpage, it basically only reads the first line. I am using a rich textbox to display the text.

void readrss()
        {
            try
            {
                newstxt.Text = string.Empty;
                StreamReader x = new StreamReader(WebRequest.Create("http://www.xample.net/").GetResponse().GetResponseStream());
                newstxt.Text += x.ReadLine();
                x.Close();
                newstxt.Text = newstxt.Text.Replace("<", "•");
            }
            catch { }

        }
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by GAME
2

Thats because you're only reading one line. newstxt.Text += x.ReadLine(); reads a single line from the stream.
Use either x.ReadToEnd or use a while loop to itereate through each line with x.ReadLine. If you use a loop you will need to look at the x.EndOfStream property.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.