473,775 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ProgressBar incremented from outside of Form

I have, the following question:

I have a WindowsForm with ProgressBar progressBar1 and Button button1.
After onClick event on button the following method executes:

button_Click(ob ject sender, EventArgs e)
{
DatabaseOperati ons.ClearDataba se();
}

where ClearDatabase() is static method which should increment my
progress bar. How can I increment my progress bar without giving
ProgressBar object as parameter( I mean without using
ClearDatabase(p rogressBar1); - it doesn't seem to be a good way)

Thanks for any reply.

Nov 29 '06 #1
5 2476
<ma***@o2.plwro te:
I have, the following question:

I have a WindowsForm with ProgressBar progressBar1 and Button button1.
After onClick event on button the following method executes:

button_Click(ob ject sender, EventArgs e)
{
DatabaseOperati ons.ClearDataba se();
}

where ClearDatabase() is static method which should increment my
progress bar. How can I increment my progress bar without giving
ProgressBar object as parameter( I mean without using
ClearDatabase(p rogressBar1); - it doesn't seem to be a good way)
You'll need to provide *something*. If you want to decouple
DatabaseOperati ons from the UI (which is reasonable) you could give
DatabaseOperati ons a DatabasedClearP rogress event which the UI could
subscribe to, and which ClearDatabase could raise.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 29 '06 #2
You'll need to provide *something*. If you want to decouple
DatabaseOperati ons from the UI (which is reasonable) you could give
DatabaseOperati ons a DatabasedClearP rogress event which the UI could
subscribe to, and which ClearDatabase could raise.

But how can I raise ProgressBar event from this static method?

Nov 30 '06 #3
<ma***@o2.plwro te:
You'll need to provide *something*. If you want to decouple
DatabaseOperati ons from the UI (which is reasonable) you could give
DatabaseOperati ons a DatabasedClearP rogress event which the UI could
subscribe to, and which ClearDatabase could raise.

But how can I raise ProgressBar event from this static method?
You'd make the DatabaseClearPr ogress event static as well. It wouldn't
be a ProgressBar event - it would just be that the handler the UI added
would happen to update the progress bar.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 30 '06 #4
ma***@o2.pl wrote:
I have, the following question:

I have a WindowsForm with ProgressBar progressBar1 and Button button1.
After onClick event on button the following method executes:

button_Click(ob ject sender, EventArgs e)
{
DatabaseOperati ons.ClearDataba se();
}

where ClearDatabase() is static method which should increment my
progress bar. How can I increment my progress bar without giving
ProgressBar object as parameter( I mean without using
ClearDatabase(p rogressBar1); - it doesn't seem to be a good way)
I think the issue is that ClearDatabase() should probably NOT be static. You
could create a database "engine" and then have an event on it to indicate
status, completion, what have you. Then subscribe to them from your UI and
have the event handler post to the progress bar.

--
Thomas T. Veldhouse
Key Fingerprint: D281 77A5 63EE 82C5 5E68 00E4 7868 0ADC 4EFB 39F0
Nov 30 '06 #5
Thomas T. Veldhouse <ve*****@yahoo. comwrote:
I think the issue is that ClearDatabase() should probably NOT be static. You
could create a database "engine" and then have an event on it to indicate
status, completion, what have you. Then subscribe to them from your UI and
have the event handler post to the progress bar.
While I agree that it would be good to have a database engine instance,
there's nothing to stop the OP from having a static event.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 30 '06 #6

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

Similar topics

1
1458
by: Job Lot | last post by:
I have a module which performs data processing job and as each row is processed progress bar value is incremented. Now I have moved this module in a separate class. How can I increment the value progress bar which resides on the main form? Do I have to pass the progress bar to my class, or there’s some other way?
1
9565
by: Geir Baardsen | last post by:
Hi! Is there any clear examples on how to use the Progressbar (6.0) in ms access 2000 anywhere? Me.Name
8
19633
by: needin4mation | last post by:
Please consider: foreach (ListViewItem item in listViewFiles.Items) { // Display the ProgressBar control. pBar1.Visible = true; // Set Minimum to 1 to represent the first file being copied. pBar1.Minimum = 1; // Set Maximum to the total number of files to copy. pBar1.Maximum = 4; //filenames.Length;
1
5427
by: Mehr H | last post by:
I've been trying to figure out how i can embed a Windows.Forms.ProgressBar in my webform (aspx) file. I have tried putting a Windows.Forms.ProgressBar as public on a regular winform designer form (form called ProgressForm) and the built the dll. Then I reference this new assembly from within my asp.net applicaiton and tried to access Windows.Forms.ProgressBar from within the ProgressForm but apparently it doesn't work. Because it won't...
2
1249
by: Steven Smith | last post by:
is it possible to change the color of the step blocks from the default blue which are incremented in the progressbar control or is this goverened by windows ? I tried Me.prgSplashScreen.ForeColor = Color.Gold() &
2
4507
by: sotto | last post by:
I need a loginscreen, that will show a progressbar that changes values based on a method in the main application (loading data from database) how would i do this? (i guess i need threading for this) the main application shouldn't be accessible when the login password hasn't been entered correctly. anybody who can give me some help with this?
2
11126
by: =?Utf-8?B?QWFyb24=?= | last post by:
Since some controls such as the DataGridView take a long time to update themselves when performing certain tasks, I have added a StatusStrip with a ProgressBar on it. While I am updating the controls on the form, I want the ProgressBar to scroll in marquee mode. However, I cannot seem to get this to work. I set the StatusStripLabel to the text I want such as "Updating data..." and then set the ProgressBar's Style property to Marquee...
1
1553
Kermit
by: Kermit | last post by:
Hi. I've searched the forum for answer, but haven't found one. The problem is with displaying the label. When the progressBar is incremented I change the text of the Label, but it doesn't update. I called invalidate on the label, and on it's parent, but it didn't change the text. I also tried to do that using ToolStripProgressBar and ToolStripLabel, but they also don't work :( An example Code:
6
10707
by: JB | last post by:
Hi All, I have a Windows Form application that shows a "please wait" form while I query a database for various information. I display my form using Show, then run my DB query, then Close the form at the end. To make it look even nicer I placed a marquee style Progress Bar on my form. It works exactly the same way, but the marquee style progress bar
0
10270
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
10109
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
10051
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
8940
agi2029
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...
1
7464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6718
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
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2854
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.