Working with StatusStrips

Nov 13, 2009 at 6:34 PM

I have the following designer generated code in my application:

            //
            // resultsStatusStrip
            //
            this.resultsStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.resultsToolStripStatusLabel,
            this.messageToolStripStatusLabel});
            this.resultsStatusStrip.Location = new System.Drawing.Point(0, 256);
            this.resultsStatusStrip.Name = "resultsStatusStrip";
            this.resultsStatusStrip.Size = new System.Drawing.Size(697, 22);
            this.resultsStatusStrip.TabIndex = 2;
            this.resultsStatusStrip.Text = "statusStrip1";
            //
            // resultsToolStripStatusLabel
            //
            this.resultsToolStripStatusLabel.Name = "resultsToolStripStatusLabel";
            this.resultsToolStripStatusLabel.Size = new System.Drawing.Size(96, 17);
            this.resultsToolStripStatusLabel.Text = "0 results displayed";
            //
            // messageToolStripStatusLabel
            //
            this.messageToolStripStatusLabel.Name = "messageToolStripStatusLabel";
            this.messageToolStripStatusLabel.Size = new System.Drawing.Size(0, 17);

So how do I check the text of the ToolStripStatusLabels? 

I tried like this:

            window.Get<StatusStrip>("resultsStatusStrip").Get<Label>("resultsToolStripStatusLabel").Text

and this:

            window.Get(SearchCriteria.ByAutomationId("resultsToolStripStatusLabel")

and this:

           window.Get<StatusStrip>("resultsStatusStrip").Get(SearchCriteria.ByAutomationId("resultsToolStripStatusLabel")

and none of them worked.

Nov 13, 2009 at 6:54 PM

Okay so after using UISpy, I found that this worked:

 window.Get<StatusStrip>("resultsStatusStrip").Get<TextBox>("StatusBar.Pane0");