473,320 Members | 1,961 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 not set right when called, waits for next procedure to finish.

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
Nov 21 '05 #1
4 5049
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" <naxtell at progeny dot net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

Nov 21 '05 #2
* "nate axtell" <naxtell at progeny dot net> scripsit:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
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
Nov 21 '05 #4
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.
Nov 21 '05 #5

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

Similar topics

0
by: Giovane Calabrese | last post by:
ok. im try to make a multilanguage system based on that tutorial : http://www.123aspx.com/redir.aspx?res=29112 in my aspx pages all text are in labels , and i want to take the name labels...
2
by: xzzy | last post by:
I need to update the .Text of a label until the user logs out. but get this error: Error: Method name expected I have listed the code below and the offending line of code is delimited by ...
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
2
by: rigamonk | last post by:
I have a form that runs a procedure when a button is clicked. the procedure does a few things, then outputs the results to labels on a form....which it does fine. However, when I call that...
5
by: Rich | last post by:
The following code snipet won't run if I initialize my global label array outside of a procedure - say Form_Load. If I initialize the array inside Form_Load then it works. Is there a way to...
0
by: Hawk | last post by:
Hello, this is my first post hope to get some good answers. I am using asp.net 2.0 and I am trying to pass the value entered in the formview textbox in insert mode "in this case it is the...
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...
7
by: David | last post by:
i think i just realized i'm an idiot. again. (not syntactically correct code... just pieces to illustrate) class StateObject { members like socket, receiveBuffer, receiveBufferSize,...
9
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have a MDI Container Form, with one label control on the Background of this container form. When I now open a child form, this form is behind the label ... and this looks ugly ... :-))...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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

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.