label not updating

dpan

Active member
Joined
Nov 22, 2005
Messages
28
Programming Experience
Beginner
VB.NET:
[COLOR=#00007f]Private[/COLOR] [COLOR=#00007f]Sub[/COLOR] Button1_Click([COLOR=#00007f]ByVal[/COLOR] sender [COLOR=#00007f]As[/COLOR] System.[COLOR=#00007f]Object[/COLOR], [COLOR=#00007f]ByVal[/COLOR] e [COLOR=#00007f]As[/COLOR] System.EventArgs) [COLOR=#00007f]Handles[/COLOR] Button1.Click
        Label1.Text = "downloading file ...."


        My.Computer.Network.DownloadFile _
            ("http://dl.winsite.com/files/650/ar2/win3/winsock/i-pal.zip", _
            "i-pal.zip", "", "", [COLOR=#00007f]False[/COLOR], 1000, [COLOR=#00007f]True[/COLOR])

        Label1.Text = Label1.Text & " done"
    [COLOR=#00007f]End[/COLOR] [COLOR=#00007f]Sub[/COLOR]
Ok the label will not update from blank to downloading file....
It only updates after the file is downloades.



Any ideals why this is not working?

Sorry I put this in the wrong forum...
 
Last edited:
The UI thread doesn't get a chance to update the Label before it starts downloading the file and then it's too busy. Try calling the Label's Refresh method before starting the download. I think a better option would be to change your fifth parameter to True and display a progress dialogue.

Moved to more appropriate forum.
 
Back
Top