Export (0) Print
Expand All

StatusBar.Text Property

Gets or sets the text associated with the StatusBar control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
public override string Text { get; set; }
/** @property */
public String get_Text ()

/** @property */
public void set_Text (String value)

public override function get Text () : String

public override function set Text (value : String)

Not applicable.

Property Value

The text associated with the StatusBar control.

This property represents the text displayed by the control.

Caution noteCaution:

The StatusBar control displays only the first 127 characters of a string.

The following code example demonstrates how to use the Text property. To run the example, paste the following code in a form. Call the InitializeSimpleStatusBar method in the form's constructor or Load method.

// Initialize a single-panel status bar.  This is done
// by setting the Text property and setting ShowPanels to False.

private void InitializeSimpleStatusBar()
{

    // Declare the StatusBar control
    StatusBar simpleStatusBar = new StatusBar();

    // Set the ShowPanels property to False.
    simpleStatusBar.ShowPanels = false;

    // Set the text.
    simpleStatusBar.Text = "This is a single-panel status bar";

    // Set the width and anchor the StatusBar
    simpleStatusBar.Width = 200;
    simpleStatusBar.Anchor = AnchorStyles.Top;

    // Add the StatusBar to the form.
    this.Controls.Add(simpleStatusBar);

}

// Initialize a single-panel status bar. This is done
// by setting the Text property and setting ShowPanels to False.
private void InitializeSimpleStatusBar()
{
    // Declare the StatusBar control
    StatusBar simpleStatusBar = new StatusBar();
    // Set the ShowPanels property to False.
    simpleStatusBar.set_ShowPanels(false);
    // Set the text.
    simpleStatusBar.set_Text("This is a single-panel status bar");
    // Set the width and anchor the StatusBar
    simpleStatusBar.set_Width(200);
    simpleStatusBar.set_Anchor(AnchorStyles.Top);
    // Add the StatusBar to the form.
    this.get_Controls().Add(simpleStatusBar);
} //InitializeSimpleStatusBar 

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft