473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Label.Text refresh .... ?

When the user clicks the download button I am changing the text of a label
control and do download operation.

The download part of the code makes the application appears like stop
responding.

My question is how to refresh the windows form right after changing the
label text.

I am talking about VB.Net desk top application developed using .Net
Framework 1.1

Thanks,

Smith
Nov 21 '05 #1
4 5287
I am not sure if I really understand your post, but if you click a button to
download something & then try to update a label. Am I right? If so, run your
download from a new thread & then update your label text

Imports System.Threading

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim t As Thread = New Thread(AddressOf Download)
t.Start()
Label1.Text = "Download Started"
End Sub

Private Sub Download()
' Do the download part here
End Sub

I hope this helps

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Hi !
The download part of the code makes the application appears like stop
responding.
My question is how to refresh the windows form right after changing the
label text.


You can either call Application.DoEvents() right after you change the
Label.Text property or make the download part in an other thread which
should make the download completely invisible to the user (the app won't
freeze or something).

--
Best Regards
Yanick
Nov 21 '05 #3
"Crouchie1998" <cr**********@spamcop.net> schrieb:
I am not sure if I really understand your post, but if you click a button
to
download something & then try to update a label. Am I right? If so, run
your
download from a new thread & then update your label text


In addition to your reply:

Note that some download methods in the .NET Framework provide support for
asynchronous operation. Otherwise, as you say, a worker thread is the way
to go. However, it's not allowed to access Windows Forms controls from
within the thread, so if you want to access the UI from within the thread,
you'll have to use interop techniques:

Multithreading in Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=multithreading&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Thanks to all of you,
Your reply helped me.
Smith

"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Hi !
The download part of the code makes the application appears like stop
responding.
My question is how to refresh the windows form right after changing the
label text.


You can either call Application.DoEvents() right after you change the
Label.Text property or make the download part in an other thread which
should make the download completely invisible to the user (the app won't
freeze or something).

--
Best Regards
Yanick

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: BillZondlo | last post by:
How come when I put the label text setting here: /// The main entry point for the application. /// </summary> static void Main() { Application.Run(new Form1()); } private void LoadInfo()
1
by: maria | last post by:
Hi I hope some one can help me I have a table of type <asp:Table>. This table is filled in runtime with labels and textboxes(also server controls). I have written a function i jscript since...
2
by: kaczmar2 | last post by:
I have an ASP.NET page written in VB.NET that has a label: <asp:Label runat="server" ID="lblStatus" CssClass="LabelTxt"></asp:Label> In my code behind, I am running some stored procedures and...
4
by: nate axtell | last post by:
In a VB .NET app I changed the text of a label then proceed to run a stored procedure which takes about 20 seconds. The label change doesn't show until after the stored procedure is finished. Is...
2
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET...
3
by: ASP Developer | last post by:
I have a variety of pages that use a master page. For some reason when I attempt to copy any of the label text on the screen it seems to highlight most of the screen randomly and I can't simply...
1
by: rmiah | last post by:
Hi I am using Visual Basic 2005. I have a stream of data which I want to set over 20 label.text properties. Instead of setting the data individually ie label1.text = ....label2.text=........
12
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the...
6
by: MehrnooshD | last post by:
Hello,I am new to C#. I have a UserControl. I could not Refresh a label text in the UserControl from another form. The Codes are: public partial class ImagePBX : UserControl { ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.