Webclient gets stuck in download  
Author Message
ShadowRayz





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

Im sorry if that hes ben asked befor but i did a seach and found nothing ..

wen i use WebClient to download files it makes the app like stop respond to buttons and others while it downloads..
is there a way to make it work normaly while it downloads files .




.NET Development32  
 
 
Jorg Jooss - MSFT





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

That's actually more of a Windows Forms "issue". You have to run lengthy operations on a separate worker thread in order to keep the UI responsive. Windows Forms 2.0 features the BackgroundWorker component, which takes care of all the necessary thread management. Another option is to use asynchronous I/O with WebClient.
 
 
ShadowRayz





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

Thx i fixed it ;D

*but i got tosay microsoft dont explain it too well i got to say...becouse they all ways have to mess it up..add stuff that it will work without 'em too...
i just added the BG worker..called it and putted all my WebClient code inside and thats it...work good and Form respond.*

 
 
Jorg Jooss - MSFT





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

There's nothing messed up here. If you perform a lengthy operation in a single-threaded program, the application has to wait for that operation to finish. It's pretty much like introducing traffic lights in a Formula 1 race.


 
 
ShadowRayz





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

Not here..at the BG worker link u gave me..
its messed up..he add so much stuff it messed up code and makes it harder for beginers to understand what starts where....thats what i think.



 
 
Jorg Jooss - MSFT





PostPosted: .NET Framework Networking and Communication, Webclient gets stuck in download Top

Sorry, I should have sent you straight here.