Label.text not set right when called, waits for next procedure to finish.

  • Thread starter Thread starter nate axtell
  • Start date Start date
N

nate axtell

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 there a way to flush the
label.text change right before the stored procedure call so that the text
will be displayed to the user while the procedure is running?
the "pseudo"code for what i have is:

Label5.Visible = True
Label5.Text = "Running procedure..."
cn.Open()
rdr = RunProcedure(cn)
cn.Close()
' comment: This is the point at which Label5 shows up on the application and
says "Running procedure..."

Thanks for any help.
-Nate
 
one - you could try adding Application.DoEvents( ) immediately after
Label5.Text = "Running Procedure..."
two - you could try Label5.Update( ) immediately after Label5.Text =
"Running Procedure..."

hope that helps..
Imran.
 
* "nate axtell said:
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 there a way to flush the
label.text change right before the stored procedure call so that the text
will be displayed to the user while the procedure is running?
the "pseudo"code for what i have is:

Try calling the label's 'Refresh' method.
 
Nate,

me.refresh does your job. (When you are still in the load even me.show,
although it can be than an incomplete form)

Mostly this is not nice your application freezes, however maybe that is just
what you want.

(There are more solutions to overcome that, by instance a thread or a timer
with doevents)

Cor
 
Wow, 4 solutions, and there are probably more. :)
Label5.Update(), Label5.refresh(), Application.DoEvents(), and me.refresh()
all worked for me.
Thanks for all your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top