Search code examples
c#winformstexttoolstripstatuslabel

ToolStripStatusLabel not behaving like other typelike controls


Im having some trouble with a ToolStripStatusLabel in Winforms application. To better explain i have some code here

bottomLbl.Text = "Adding file(s) to list...";
this.Text = "Adding file(s) to list...";

listAllFiles(carrier, type, chkListBox, withDestSystem, listBox, cmbBox);

bottomLbl.Text = "Done!";
this.Text = "Done";

What i dont get is, that this.Text does change to "Adding files.." but not bottomLbl even though i set it to do so before this.text. Both controls get the "Done!" text after the listAllFiles function has been run.

But is there something special i have to do on a ToolStripStatusLabel ?


Solution

  • You need to refresh the form before calling the function

    bottomLbl.Text = "Adding file(s) to list...";
    this.Text = "Adding file(s) to list...";
    this.Refresh();
    
    listAllFiles(carrier, type, chkListBox, withDestSystem, listBox, cmbBox);
    
    bottomLbl.Text = "Done!";
    this.Text = "Done";