Re: ProgressBar incremented from outside of Form

Tech-Archive recommends: Fix windows errors by optimizing your registry



mamin@xxxxx 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(object sender, EventArgs e)
{
DatabaseOperations.ClearDatabase();
}

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(progressBar1); - 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


.


Quantcast