Re: How to get an object to inform progress via a form's status bar?

Tech-Archive recommends: Speed Up your PC by fixing your registry




Simon Tamman wrote:

(code snipped)
The above code will update the title of a given form without locking up in
thread hanging badness.

I guess I just don't understand - it looks to my eye as though the
class (of the object) that's doing the stuff doesn't have any
"communication code" in your (and everyone else's) examples? How on
earth does the form know what's going on with the object, if the object
doesn't have any code "telling" the form what's going on?

I was probably unclear about what I'm dealing with. Here's a minimal
"template" example:

public class myform : system....form
{
..
..
..

private void btn_awesomeButton_Click(object sender, System.EventArgs e)
{
killerObject ko = new killerObject;
ko.doSomethingRockin();
}

}

public class killerObject
{
..
..
..

public doSomethingRockin()
{
(loop to delete 1000 hardcoded files here)
}

}

What I want to do is have the status bar (or any control) on the form
be updated every pass thru the loop in the object created by the button
click event (say with the name of the file being deleted).

Does that make sense even? Does your suggestion suffice for what I'm
after? I would've thought that some code would have had to have been
added to killerObject *as well as* to the form.

thanks for the replies all! sorry if I was unclear...

.


Quantcast