Results 1 to 9 of 9

Thread: progressBar

Threaded View

  1. #1

    Thread Starter
    Frenzied Member met0555's Avatar
    Join Date
    Jul 2006
    Posts
    1,385

    progressBar

    Hi,

    I currently have a code, and i would like my progress bar to increase while the current code is running. How can i do it?
    Thx

    request Code:
    1. using System;
    2. using System.IO;
    3. using System.Net;
    4. using System.Text;
    5.  
    6. namespace Examples.System.Net
    7. {
    8.     public class WebRequestPostExample
    9.     {
    10.         public static void Main ()
    11.         {
    12.             // Create a request using a URL that can receive a post.
    13.             WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");
    14.             // Set the Method property of the request to POST.
    15.             request.Method = "POST";
    16.             // Create POST data and convert it to a byte array.
    17.             string postData = "This is a test that posts this string to a Web server.";
    18.             byte[] byteArray = Encoding.UTF8.GetBytes (postData);
    19.             // Set the ContentType property of the WebRequest.
    20.             request.ContentType = "application/x-www-form-urlencoded";
    21.             // Set the ContentLength property of the WebRequest.
    22.             request.ContentLength = byteArray.Length;
    23.             // Get the request stream.
    24.             Stream dataStream = request.GetRequestStream ();
    25.             // Write the data to the request stream.
    26.             dataStream.Write (byteArray, 0, byteArray.Length);
    27.             // Close the Stream object.
    28.             dataStream.Close ();
    29.             // Get the response.
    30.             WebResponse response = request.GetResponse ();
    31.             // Display the status.
    32.             textbox1.text = (((HttpWebResponse)response).StatusDescription);
    33.             // Get the stream containing content returned by the server.
    34.             dataStream = response.GetResponseStream ();
    35.             // Open the stream using a StreamReader for easy access.
    36.             StreamReader reader = new StreamReader (dataStream);
    37.             // Read the content.
    38.             string responseFromServer = reader.ReadToEnd ();
    39.             // Display the content.
    40.             textbox2.text (responseFromServer);
    41.             // Clean up the streams.
    42.             reader.Close ();
    43.             dataStream.Close ();
    44.             response.Close ();
    45.         }
    46.     }
    47. }
    Last edited by met0555; Aug 17th, 2009 at 08:22 PM.

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