I am trying to update the status strip in my Windows Forms application, but nothing is being displayed. Here is my code:
private void textBox1_TextChanged(object sender, EventArgs e)
{
lines = Regex.Split(textBox1.Text.Trim(), "\r\n");
lineCount = lines.Count();
statusStrip1.Text = "Lines: " + lineCount;
statusStrip1.Refresh();
}
You will need to add a
ToolStripStatusLabelto theStatusStrip.Then set the text of the label instead (you need to do a
statusstrip.Refreshas there is no refresh on the status-label).The
Textproperty on theStatusStripcomes from the StatusStrip inheritsToolStrip(which in turn inheritsControl), but has no visual effect due to the nature of ToolStrips. It can be a bit confusing.Example: