473,795 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"cod e 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 5075
one - you could try adding Application.DoE vents( ) 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******** ********@TK2MSF TNGP11.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"cod e 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"cod e 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.DoE vents(), 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
1795
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 ( in one loop ) and for each label take on the XML document the right(in the right language) Value (text).
2
1530
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 //The next line breaks: Error: Method name expected
6
3164
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 works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
2
1423
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 procedure again (in the same instance of the program), the labels do not update. i have tried resetting the text. update(), refresh(), beginUpdate() and endUpdate(), Invalidate() and a few others that sounded pretty good ;-) no dice. any ideas?
5
2335
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 initialize the label array outside of a procedure as I am doing? Or... (see below this snipet) --------------------------------------------------------------------------------- Public Class Form1 Inherits System.Windows.Forms.Form " Windows Form...
0
1184
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 default mode" to a label or hidden field outside of the formview when the insert button is pushed. Is there a way to do this? The App I am creating using many interrelated tables by forgiegn keys and in this case I need to insert a record in one...
12
13278
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 same Tag number. (I thought it might help) The checkboxes name is a concatenation of "chkCancel" and a number that represents the order in which they were created: chkCancel0 (Tag = 0) chkCancel1 (Tag = 1)
7
1959
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, StringBuilder etc.. }
9
8029
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 ... :-)) When I set the label with "SendToBack", it completely disapears. I also tried to set the child form like "BringToFront" but this also does not help.
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.