[vb][c#]

Joined
May 18, 2007
Messages
1,787
Reaction score
291
I'm using function below, but the time it takes to complete it is over 4-5 seconds. I would like to know if there was a better way, maybe instant for it do the same thing. Would it be less time consuming depending on what language I used, or is it just built that way?


Code:
Dim client As New WebClient
        result = client.DownloadString(url)
 
I'm using function below, but the time it takes to complete it is over 4-5 seconds. I would like to know if there was a better way, maybe instant for it do the same thing. Would it be less time consuming depending on what language I used, or is it just built that way?


Code:
Dim client As New WebClient
        result = client.DownloadString(url)

It actually deppends on the internet speed of the user, how big the data is, or how fast the computer is running the program.

What you could do.. in c#

is create a void, and start it up as a thread like:

Code:
void download()
{
    url = "http://website.com";
    WebClient client = new WebClient();
    client.DownloadString(url);
}

and on your button or what ever type in

Code:
(new Thread(download)).Start();

That way, it's separated and the form will not freeze, and you can do other things at the same time.
 
Last edited:
I did the exact same thing in vb. Created a new thread and run a progress bar. It's only downloading a single string. Maybe 3-4 numbers. That's it. I don't think it should take 5 seconds to download 3-4 numbers lol. I'll try doing it in C# to see if I get faster results.
 
I did the exact same thing in vb. Created a new thread and run a progress bar. It's only downloading a single string. Maybe 3-4 numbers. That's it. I don't think it should take 5 seconds to download 3-4 numbers lol. I'll try doing it in C# to see if I get faster results.

Yeah, I don't know. Deppends on the speed of the internet, or the process.
 
Back