Using StatusStrip In Windows Forms


In this article, I am going to explain how to use a StatusStrip in a Windows Forms app using Visual Studio 2017.

STEP 1 - Start the Project

Let's create a new project using Visual Studio 2017.
Select New Project--->Visual C#-->Windows Forms App (.NET Framework), give your project a name and click OK.
Using StatusStrip In Windows Forms 
This action creates a WinForms project with a default form and you should see the Windows designer.  

STEP 2 - Drag and Drop Control

Let's add a StatusStrip control to the form by dragging it from Toolbox and dropping it to the form. You will see a StatusStrip 1 is added to the form. This control is now availabe to you in the code behind.
Using StatusStrip In Windows Forms 
StatusStrip Control
StatusStrip control displays windows status. It is usually at the bottom of a window. We use a ToolStrip hyperlink in the C# windows forms Status Bar.
StatusStrip replaces and extends the Status Bar control of the previous version. StatusStrip control displays information about an object being viewed on a form, the object components or contextual information that relates to that object's operation within the application.
Typically, a StatusStrip consists of ToolStrip objects, but by default, StatusStrip has no panels. ToolStrip control is capable of hosting Button, Label, SplitButton, DropDownButton, Separator, ComboBox, TextBox, and ProgressBar controls.
Now, let's add another control to the form by dragging a n control from the Toolbox to the form. You may also want to change the properties of the other controls.
Using StatusStrip In Windows Forms 
Let's add a Label, Button and Textbox control to the form. Change the text of button and Label controls to what you like.

STEP 3 - Coding 

Follow the coding given below,
  1. private void textBox1_MouseHover(object sender, EventArgs e) {  
  2.  toolStripStatusLabel1.Text = "Enter User Name ";  
  3. }  
  4. private void textBox1_MouseLeave(object sender, EventArgs e) {  
  5.  toolStripStatusLabel1.Text = "";  
  6. }  
  7. private void textBox2_MouseHover(object sender, EventArgs e) {  
  8.  toolStripStatusLabel1.Text = "Enter Password with minimum one character";  
  9. }  
  10. private void button1_MouseHover(object sender, EventArgs e) {  
  11.  toolStripStatusLabel1.Text = "Click here to Login";  
  12. }   

STEP 4 - Compile and Run

Now simply compile and run the application.
Once you place the cursor on the Textbox and Button, the corresponding text belonging to that will be displayed on the Status Bar.
Using StatusStrip In Windows Forms
Using StatusStrip In Windows Forms
Using StatusStrip In Windows Forms 
In this basic article, you saw how to use a StatusStrip control. Hope you found this article interesting. For any feedback, please post it as comments at the bottom of this article. Thank you!.