Background:
The Program runs a query on a SQL Database, then it takes the gathered information and outputs it into an excel document and saves it to a specified location. Problem:
Originally I was using a Label and ProgressBar Located in the form itself but for the sake of appearance I decided it would look better to create a StatusStrip. I relocated the uiFileCreationL abel and uiFileCreationP rogressBar to the Status strip as a StatusLabel and ProgressBar. After doing so the ProgressBar worked flawlessly and looked awesome, but the StatusLabel did not follow the ProgressBar's example of good behavior. The code is run inside a Button_Click and the label is supposed to update with the current Percentage of the Overall File Creation. The Only time the label actually updates its text, despite the fact that the code says it should update 4 times for 1 set of files or 6 times for 2 sets of files, is the last time of the updates. Question:
How can I make the StatusLabel Text update itself? Do I need to call a separate function outside of the Button_Click to update the text specifically? -
Button1_Click(ByVal sender as System.Object, ByVal e As System.EventArgs) Handles Button1.Click
-
‘ Declarations and other code
-
-
' Progress Bar Initialization
-
uiFileCreationProgressBar.Maximum = uiDistrictsSelectedListBox.Items.Count * 2
-
uiFileCreationProgressBar.Value = dCount
-
uiFileCreationLabel.Text = uiFileCreationProgressBar.Value '"Starting File Creation"
-
-
Me.UseWaitCursor = True
-
-
' For-loop to Create seperate Query files
-
For dCount = 0 To uiDSelectedListBox.Items.Count - 1
-
' Set file name
-
If (uiUploadTypeComboBox.SelectedIndex = 1) Then
-
fileName = "Custom - " _
-
& Convert.ToString(uiDSelectedListBox.Items.Item(dCount))
-
Else
-
fileName = Convert.ToString(uiDSelectedListBox.Items.Item(dCount))
-
End If
-
-
File1Create(fileLocation, fileName, dCount, connstring)
-
uiFileCreationProgressBar.Value = dCount * 2 + 1
-
uiFileCreationLabel.Text = Convert.ToInt32((((dCount * 2) + 1) / (uiDSelectedListBox.Items.Count * 2)) * 100) & "% Complete"
-
File2Create (fileLocation, fileName, dCount, connstring)
-
uiFileCreationProgressBar.Value = dCount * 2 + 2
-
uiFileCreationLabel.Text = Convert.ToInt32((((dCount * 2) + 2) / (uiDSelectedListBox.Items.Count * 2)) * 100) & "% Complete"
-
Next
-
-
' Remove wait cursor
-
uiFileCreationLabel.Text = uiFileCreationProgressBar.Value '"100% Completed"
-
Me.UseWaitCursor = False
-
MsgBox("File(s) Created Succesfully.", 0, "File Creation Status")
-
uiFileCreationLabel.Text = uiFileCreationProgressBar.Value '"Press View Report to Begin."
-
-
Comments:
Thank you for any help you have to offer me. If you need any more explanation to help or more code just let me know.
3 4475 Plater 7,872
Recognized Expert Expert
Whenever you want a control to re-draw itself, use the .Update() function on it.
myStatusLAbel.U pdate() will force the UI to redraw itself.
I didn't look to closely at your code, but this works fairly often to solve that kind of problem.
I ended up figuring it out. I'm not sure if you can update the label itself but what i was able to do is tell the StatusStrip to .Refresh() and that refreshes the label and progress bar.
Thank you for your help though.
Plater 7,872
Recognized Expert Expert
All controls have the .Update(), Refresh() is roughly the same thing though.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jim Hubbard |
last post by:
When you add a StatusStrip to a WinForm and add a Progressbar to the
StatusStrip, setting the Progressbar alignment to "Right" does not move the
Progressbar to the right on the Statusbar.
Is this a bug?
|
by: windsurfing_stew |
last post by:
Hi,
Winforms has the new StatusStrip control that replaces StatusBar in
1.1. I've looked high and low but can't seem to find how to get
separators (|) in my status bar, eg
Info1 | Info2 | Info3 | Info4
where Infos 1 to 4 are StatusLabels.
|
by: robertino |
last post by:
Hi all,
(VS 2005 Pro, XP) I'm trying to place a statusstrip control on a window
such that it acts like a statusstrip (!).
Every time I try this, no matter what I do, I find that when I maximise
other containers on the form to fill its' available surface, then these
other controls slip behind the statusstrip to fill ALL the form's
surface as if the statusstrip didn't even exist!. Statustrip dock
property is bottom, other controls all...
|
by: Marc |
last post by:
Hello,
I have a vb.net form that I've added a StatusStrip at the bottom. On that
StatusStrip I've added a DropDownButton on which I've added a Menu
containing 4 sub Items
|
by: Rich |
last post by:
Hello,
I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar
object - which contains panels and I can see the properties of the statusbar
in the properties window in vb2005.
But in the tools list of vb2005 I do not see a statusbar selection. Instead
I see a statusStrip, and even though the Items collection has a property to
set the statusStrip labels to sunken, etched,... I can see these appearances
when I...
| |
by: jcvoon |
last post by:
Hi:
I'm using VS2005, I've create a winform with the following controls:
Add a ToolStripContainer
Set it to dock to the form (Fill)
Click in the top section.
Add a menu strip
Add a tool strip.
Add another tool strip.
|
by: Carla Simeoni |
last post by:
I added a StatusStrip "Sstrip1" to a Form "Form1".
In the procedure
private void Form1_Load(...)
I added the following statement:
Sstrip1.Text = "Text in my StatusStrip";
|
by: S. Viswanathan |
last post by:
Hi!
When mouse over on menuitem, the corresponding menuitem text should display
in StatusStrip control.
How to do this?
Simillarly for when mouse over on toolstrip item, the corresponding
toolstrip button tag property need to be taken.
|
by: hzgt9b |
last post by:
Using VS2005 (.NET 2.0), VB.NET,
I have a windows forms application. I have a StatusStrip containing a
ToolStripStatusLabal and a ToolStripProgressBar.
I want to force the status label to behave like it's docked to "Fill"
inside the StatusStrip and force the progress bar to behave like it's
docked to "Right" inside the StatusStrip. Unfortunately I do not see
any way to accomplish this using just one StatusStrip control.
Does anyone...
|
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,...
|
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...
| |
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |