Hi everyone,
My application is a C# Windows form application. When the user presses the button "Generate" my application creates a new thread and run the new process the process goes something like this pseudo code below
Loop counter = 1 to N
progressbar = counter/N
Display msg on label1
Do some tasks
Loop
progressbar = 100%
Display msg on lable1
I've delegate my processbar and label msgs, the messages shows up when it's within the loop with no problem I've even added an event to run Application.DoEvents() whenever the label text changes , however my last msg NEVER shows up, I've tried placing Application.DoEvents() right after the last msg label, however no solution. Anyone else encounter this before?
Thanks for the help everyone!
Edit
this is how I coded my last msg (The one after the loop)
this.BeginInvoke((MethodInvoker)delegate()
{
toolStripProgressBar1.Value = 100;
btnCancel.Enabled = false;
btnBrowse.Enabled = true;
btnSaveTo.Enabled = true;
btnGenerate.Enabled = false;
// Performance testing
lblGeneratingInfo.Text = "Generation Complete! Total Run time: " + DateTime.Now.Subtract(startDate).ToString();
});
FIXED: I'm assuming the text I tried to display was too long... when I replaced "Generating Complete: Total run time " with just "Run time: " it displayed o_o