Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralMessage Removed Pin
1-May-10 4:46
harold aptroot1-May-10 4:46 
GeneralRe: An object reference is required for the non-static field, method, or property !? :( Pin
Luc Pattyn1-May-10 5:05
sitebuilderLuc Pattyn1-May-10 5:05 
GeneralMessage Removed Pin
Luc Pattyn1-May-10 5:23
sitebuilderLuc Pattyn1-May-10 5:23 
GeneralRe: An object reference is required for the non-static field, method, or property !? :( Pin
OriginalGriff1-May-10 5:34
mveOriginalGriff1-May-10 5:34 
GeneralRe: Interesting Pin
Luc Pattyn1-May-10 5:42
sitebuilderLuc Pattyn1-May-10 5:42 
QuestionAsynchronous downloading in C# [modified] Pin
Sunil G30-Apr-10 21:31
Sunil G30-Apr-10 21:31 
AnswerRe: Asynchronous downloading in C# Pin
Abhinav S30-Apr-10 21:57
Abhinav S30-Apr-10 21:57 
AnswerRe: Asynchronous downloading in C# Pin
Peace ON30-Apr-10 22:50
Peace ON30-Apr-10 22:50 
Using WebClient you can download your file synchronously as well as asynchronously.

Download File Synchronously
using System.Net;

WebClient webClient = new WebClient();
webClient.DownloadFile("http://mysite.com/myfile.txt", @"c:\myfile.txt");



Download File Asynchronously

private void btnDownload_Click(object sender, EventArgs e)
{
  WebClient webClient = new WebClient();
  webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
  webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
  webClient.DownloadFileAsync(new Uri("http://mysite.com/myfile.txt"), @"c:\myfile.txt");
}

private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
  progressBar.Value = e.ProgressPercentage;
}

private void Completed(object sender, AsyncCompletedEventArgs e)
{
  MessageBox.Show("Download completed!");
}


Hope this will help!
Jinal Desai - LIVE

GeneralRe: Asynchronous downloading in C# Pin
Sunil G30-Apr-10 23:07
Sunil G30-Apr-10 23:07 
AnswerRe: Asynchronous downloading in C# [modified] Pin
Peace ON2-May-10 22:18
Peace ON2-May-10 22:18 
AnswerRe: Asynchronous downloading in C# Pin
Ravi Bhavnani1-May-10 14:15
professionalRavi Bhavnani1-May-10 14:15 
AnswerRe: Asynchronous downloading in C# Pin
Abdul Rahman Hamidy2-May-10 22:53
Abdul Rahman Hamidy2-May-10 22:53 
QuestionHow to make line hover when hovering with mouse in Richtext control Pin
Natural_Demon30-Apr-10 11:38
Natural_Demon30-Apr-10 11:38 
AnswerRe: How to make line hover when hovering with mouse in Richtext control Pin
Abhinav S30-Apr-10 18:25
Abhinav S30-Apr-10 18:25 
QuestionIs this good code practice? Pin
venomation30-Apr-10 10:08
venomation30-Apr-10 10:08 
AnswerRe: Is this good code practice? Pin
#realJSOP30-Apr-10 11:38
mve#realJSOP30-Apr-10 11:38 
GeneralRe: Is this good code practice? Pin
venomation30-Apr-10 11:42
venomation30-Apr-10 11:42 
GeneralRe: Is this good code practice? Pin
#realJSOP30-Apr-10 12:02
mve#realJSOP30-Apr-10 12:02 
GeneralRe: Is this good code practice? Pin
PIEBALDconsult30-Apr-10 13:27
mvePIEBALDconsult30-Apr-10 13:27 
GeneralRe: Is this good code practice? Pin
harold aptroot30-Apr-10 11:55
harold aptroot30-Apr-10 11:55 
GeneralRe: Is this good code practice? Pin
#realJSOP30-Apr-10 12:00
mve#realJSOP30-Apr-10 12:00 
GeneralRe: Is this good code practice? Pin
harold aptroot30-Apr-10 12:04
harold aptroot30-Apr-10 12:04 
GeneralRe: Is this good code practice? Pin
#realJSOP30-Apr-10 12:09
mve#realJSOP30-Apr-10 12:09 
GeneralRe: Is this good code practice? Pin
PIEBALDconsult30-Apr-10 12:50
mvePIEBALDconsult30-Apr-10 12:50 
GeneralRe: Is this good code practice? Pin
Roger Wright30-Apr-10 16:29
professionalRoger Wright30-Apr-10 16:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.