Multi-threading is a concept I am attempting to understand. I Am simply trying to create a "Working Please Wait" window with a Text message update as to the progress.
I cannot seem to Send a Message back to that thread to update the text message.
Here is how I am Starting my Thread:
frmProcessing Fp;
Thread FpThread = new Thread(() => {
Fp= new frmProcessing();
Fp.Tital("Building Database");
Fp.Working("Clearing Old Data...");
Fp.ShowDialog();
});
FpThread.SetApartmentState(ApartmentState.STA);
FpThread.Start();
Attempting to run this function from the Thread preforming the updating action(original thread):
Fp.Working("new message");
I attempted this:
Fp.Invoke(new Action(() => {
Fp.Working("new message");
}));
I get this error:
'Fp' is not null here.
CS0165:Use of unassigned local variable 'fp'