Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
AnswerRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Luc Pattyn24-May-09 12:05
sitebuilderLuc Pattyn24-May-09 12:05 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Abydosgater25-May-09 4:18
Abydosgater25-May-09 4:18 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Luc Pattyn25-May-09 4:31
sitebuilderLuc Pattyn25-May-09 4:31 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Abydosgater25-May-09 4:48
Abydosgater25-May-09 4:48 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Luc Pattyn25-May-09 5:35
sitebuilderLuc Pattyn25-May-09 5:35 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Abydosgater25-May-09 6:15
Abydosgater25-May-09 6:15 
GeneralRe: .Net WebBrowser control wont instanciate on form in new thread? Pin
Luc Pattyn25-May-09 6:38
sitebuilderLuc Pattyn25-May-09 6:38 
QuestionAsyncCompletedEventHandler Not Firing... Pin
Fudge Mutator24-May-09 11:21
Fudge Mutator24-May-09 11:21 
Hi guys, I'm trying to just update a progress bar in a simple app that downloads files.
The relevent code is as follows:

static void updateProgress(object sender, DownloadProgressChangedEventArgs e)
{
    progress = e.ProgressPercentage;
}

static void finishedDownload(object sender, AsyncCompletedEventArgs e)
{
    done = true;
    progress = 0;
    (sender as IDisposable).Dispose();
}

// Returns the local path where the file is downloaded to
public void downloadFile(string url)
{
    done = false;
    progress = 0;
    WebClient client = new WebClient();
    try
    {
        client.DownloadFileCompleted += new AsyncCompletedEventHandler(finishedDownload);
        client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(updateProgress);

        Console.WriteLine("Before");
        client.DownloadFileAsync(new Uri(url), Application.StartupPath + "\\temp.flv");
        Console.WriteLine("After");
    }
    catch (Exception ex)
    {
        if (client != null)
            client.Dispose();
        done = true;
        MessageBox.Show(ex.Message);
    }
}


So the problem is that updateProgress() and finishedDownload() don't get called when client.DownloadFileAsync() completes and/or updates.
What am I doing wrong?

Thanks
-Fudge
AnswerRe: AsyncCompletedEventHandler Not Firing... Pin
Manas Bhardwaj24-May-09 11:32
professionalManas Bhardwaj24-May-09 11:32 
GeneralRe: AsyncCompletedEventHandler Not Firing... Pin
Fudge Mutator24-May-09 17:43
Fudge Mutator24-May-09 17:43 
AnswerRe: AsyncCompletedEventHandler Not Firing... Pin
Luc Pattyn24-May-09 11:56
sitebuilderLuc Pattyn24-May-09 11:56 
QuestionImplemening MS-Excel ( text to columns ) function using C# Pin
MustafaHamed24-May-09 10:38
MustafaHamed24-May-09 10:38 
Questionproblem in datagrid column scrolling Pin
Shuaib wasif khan24-May-09 9:18
Shuaib wasif khan24-May-09 9:18 
AnswerRe: problem in datagrid column scrolling Pin
Luc Pattyn24-May-09 9:31
sitebuilderLuc Pattyn24-May-09 9:31 
GeneralRe: problem in datagrid column scrolling Pin
Shuaib wasif khan24-May-09 11:13
Shuaib wasif khan24-May-09 11:13 
GeneralRe: problem in datagrid column scrolling Pin
Luc Pattyn24-May-09 11:37
sitebuilderLuc Pattyn24-May-09 11:37 
Questionhow to change font for tooltip control ? Pin
xingselex24-May-09 6:44
xingselex24-May-09 6:44 
AnswerRe: how to change font for tooltip control ? Pin
dan!sh 24-May-09 6:49
professional dan!sh 24-May-09 6:49 
GeneralRe: how to change font for tooltip control ? Pin
xingselex24-May-09 6:57
xingselex24-May-09 6:57 
GeneralRe: how to change font for tooltip control ? Pin
dan!sh 24-May-09 7:04
professional dan!sh 24-May-09 7:04 
GeneralRe: how to change font for tooltip control ? Pin
xingselex24-May-09 7:11
xingselex24-May-09 7:11 
GeneralRe: how to change font for tooltip control ? Pin
dan!sh 24-May-09 7:33
professional dan!sh 24-May-09 7:33 
GeneralRe: how to change font for tooltip control ? Pin
xingselex24-May-09 7:39
xingselex24-May-09 7:39 
GeneralRe: how to change font for tooltip control ? Pin
dan!sh 24-May-09 8:08
professional dan!sh 24-May-09 8:08 
GeneralRe: how to change font for tooltip control ? Pin
xingselex24-May-09 8:13
xingselex24-May-09 8:13 

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.