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 { }

        }

Recommended Answers

All 2 Replies

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.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.