How to update StatusStrip in Windows Forms

enter image description here

You will need to add a ToolStripStatusLabel to the StatusStrip.

Then set the text of the label instead (you need to do a statusstrip.Refresh as there is no refresh on the status-label).

The Text property on the StatusStrip comes from the StatusStrip inherits ToolStrip (which in turn inherits Control), but has no visual effect due to the nature of ToolStrips. It can be a bit confusing.

Example:

private void textBox1_TextChanged(object sender, EventArgs e)
{
    //...
    lines = Regex.Split(textBox1.Text.Trim(), "\r\n");
    lineCount = lines.Count();

    //this label is added in visual editor using the default name
    ToolStripStatusLabel1.Text = string.Format("Lines: {0}", lineCount);
    StatusStrip1.Refresh();
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)