?
Solved

C# WinForms: ToolStripStatusLabel and ToolStripSeparator

Posted on 2012-09-06
5
Medium Priority
?
1,990 Views
Last Modified: 2012-09-06
How do these two work together?

Thanks.
0
Comment
Question by:newbieweb
  • 3
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 38372051
You can add both to the statusStrip.

            var toolStripStatusLabel1 = new ToolStripStatusLabel();
            toolStripStatusLabel1.Text = (string)"Pos1";

            var toolStripSeparator = new ToolStripSeparator();

            var toolStripStatusLabel2 = new ToolStripStatusLabel();
            toolStripStatusLabel2.Text = (string)"Pos2";

            statusStrip1.Items.Add(toolStripStatusLabel1);
            statusStrip1.Items.Add(toolStripSeparator);
            statusStrip1.Items.Add(toolStripStatusLabel2);

Open in new window

0
 

Author Comment

by:newbieweb
ID: 38372199
My WinForms C# program has definitions for ToolStripSeparator but I do not know where they were created ot how to access them. In the Designer.cs file

        private void InitializeComponent()
        {
            ...
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
             
            ...
        }

        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;

A case insnesitive serach of my project for "Items.Add(tool" come up empty, so these are not being added.  

A different deverloper created the ToolStripStatusLabel as well as the ToolStripSeparator.  Any idea how?  The ToolStripStatusLabel is obvious, but the existence of the 3 ToolStripSeparators confuses me.
 

Thanks!
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 38372242
You can add them in design ou in code, but you should have access to what you've created (this.ToolStripStatusLabel .Item(0)...
0
 

Author Comment

by:newbieweb
ID: 38372808
I will drop the designer concern.  The question is how what type of object do I drag onto the form?

What type if the statusStrip1 in your example?
0
 

Author Closing Comment

by:newbieweb
ID: 38373301
Thanks, got it.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question