Results 1 to 2 of 2

Thread: Httprequest?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2006
    Posts
    20

    Httprequest?

    Code:
    namespace getsource
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            private void btnget_Click(object sender, EventArgs e)
            {
                StringBuilder sb = new StringBuilder();
                HttpWebRequest request = (HttpWebRequest)
                WebRequest.Create("http://www.cohackers.com");
                HttpWebResponse response = (HttpWebResponse)
                request.GetResponse();
                Stream resStream = response.GetResponseStream();
                source.Text = "" +sb.ToString();
            }
    
            private void btnclose_Click(object sender, EventArgs e)
            {
                Close();
            }
        }
    }
    I cant get it to insert to source.Text(richTextBox)

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Httprequest?

    That's because you're trying to get it to read sb, to which nothing has been assigned.

    Code:
    StreamReader sr;
    
    sr = new StreamReader(resStream, encode, true);
    source.Text = objSR.ReadToEnd();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width