T
trint
Ok,
I have a thread that I start when user clicks to start:
ThreadStart myThreadDelegate = new ThreadStart
ThreadFunction1.getOneAtATime);
Thread thr1 = new Thread(myThreadDelegate);
thr1.Start();
The process started contains a Very large function that is in a
continuous loop (here is part of it just to demonstrate my problem):
foreach (string invoice in Class1.invoiceHolder)
{
//Constantly show a status bar
//Constantly update image control of "if tray has paper or not".
//Constantly update labels displaying info about Invoices
}
Ok,
This will need to run for days at a time in this loop...HOWEVER, I had
it in the Thread, as mentioned, and the app would just quit.
I had posted a question to this before and got the answer that
"Controls created by the initializing thread should not be touched by
processes started in other threads (creates undesirable results". Ok,
I get that, but when this thread I start runs, it MUST give updates to
users.
Ok, I have looked at Control.Invoke and don't get it. I mean that, I
couldn't figure out how to use it (mental block). Is that the answer to
my problem? (Problem being, that if I don't start this giant process in
a separate thread, when it starts in this loop, the computer starts to
crawl).
Help is appreciated.
Thanks,
Trint
I have a thread that I start when user clicks to start:
ThreadStart myThreadDelegate = new ThreadStart
ThreadFunction1.getOneAtATime);
Thread thr1 = new Thread(myThreadDelegate);
thr1.Start();
The process started contains a Very large function that is in a
continuous loop (here is part of it just to demonstrate my problem):
foreach (string invoice in Class1.invoiceHolder)
{
//Constantly show a status bar
//Constantly update image control of "if tray has paper or not".
//Constantly update labels displaying info about Invoices
}
Ok,
This will need to run for days at a time in this loop...HOWEVER, I had
it in the Thread, as mentioned, and the app would just quit.
I had posted a question to this before and got the answer that
"Controls created by the initializing thread should not be touched by
processes started in other threads (creates undesirable results". Ok,
I get that, but when this thread I start runs, it MUST give updates to
users.
Ok, I have looked at Control.Invoke and don't get it. I mean that, I
couldn't figure out how to use it (mental block). Is that the answer to
my problem? (Problem being, that if I don't start this giant process in
a separate thread, when it starts in this loop, the computer starts to
crawl).
Help is appreciated.
Thanks,
Trint