How to: Read from and Write to the Feedback Region of the Status Bar
The Feedback region of the Visual Studio status bar displays text. You can set and retrieve text, display static text, and highlight the displayed text.
To use the Feedback region of the Visual Studio Status bar
Obtain an instance of the IVsStatusbar interface, which is made available through the SVsStatusbar service.
Determine whether the status bar is frozen by calling the IsFrozen method of the IVsStatusbar instance.
Set the text of the Feedback region by calling the SetText method and passing in a text string.
Read the text of the Feedback region by calling the GetText method.
Example
This example demonstrates how to write text to and read text from the Feedback region.
Private Sub FeedbackRegionExample()
Dim statusBar As IVsStatusbar = CType(GetService(GetType(SVsStatusbar)), IVsStatusbar)
Dim frozen As Integer
statusBar.IsFrozen(frozen)
If frozen = 0 Then
' Set the status bar text and make its display static.
statusBar.SetText("Here's some static text.")
statusBar.FreezeOutput(1)
' Retrieve the status bar text.
Dim text As String
statusBar.GetText(text)
System.Windows.Forms.MessageBox.Show(text)
' Clear the status bar text.
statusBar.FreezeOutput(0)
statusBar.Clear()
End If
End Sub
void FeedbackRegionExample()
{
IVsStatusbar statusBar =
(IVsStatusbar)GetService(typeof(SVsStatusbar));
int frozen;
statusBar.IsFrozen(out frozen);
if (frozen == 0)
{
// Set the status bar text and make its display static.
statusBar.SetText("Here's some static text.");
statusBar.FreezeOutput(1);
// Retrieve the status bar text.
string text;
statusBar.GetText(out text);
System.Windows.Forms.MessageBox.Show(text);
// Clear the status bar text.
statusBar.FreezeOutput(0);
statusBar.Clear();
}
}
In the above example, the code does the following things:
Obtains an instance of the IVsStatusbar interface from the SVsStatusbar service.
Checks to see if the status bar is frozen by calling the IsFrozen method.
Inhibits further updates to the status bar by calling the FreezeOutput method.
Reads the text from the status bar by calling the GetText method and displays it in a message box.
Allows updates to the status bar by calling FreezeOutput and passing 0 in the parameter.
Clears the contents of the status bar by calling the Clear method.
See Also
Tasks
How to: Program the Progress Bar Region of the Status Bar
How to: Use the Animation Region of the Status Bar
How to: Program the Designer Region of the Status Bar