Link to home
Start Free TrialLog in
Avatar of BlakeMcKenna
BlakeMcKennaFlag for United States of America

asked on

Manually adding a ToolStripStatusLabel Issues?

My program requires that at a certain point I manually add a ToolStripStatusLabel to my StatusStrip bar. I got it working to a point but I'm not sure it's the correct or accepted way to do so. When the program runs thru the code for the first time, even though the form in question has a StatusStrip along with a ToolStripStatuslabel already added, for some reason it appears as if it doesn't.

So, I execute the following code:

    If gSBR.Items.Count = 0 Then
        gSBR.Items.Add("")
        gSBR.Items(0).TextAlign = ContentAlignment.MiddleCenter
        gSBR.Items(0).Spring = True
    End If
    gSBR.Items(0).Text = "ESC - Close Form"

========================================================================

This code works but I'm not sure why I can't run this code:

    If gSBR.Items.Count = 0 Then
        gSBR.Items.Add(ToolStripStatusLabel)
    End If  

It doesn't like the latter code.

Anyway, in the first set of code, I'm also trying to set the "Spring" property to True. Problem is, the Spring property doesn't show up in intellisense. How can I set this manually?
ASKER CERTIFIED SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BlakeMcKenna

ASKER

Perfect James...worked like a charm!

Thanks!
James,

I closed this out a little too soon. Your answer worked but was only part of the solution. I'm trying to reference the "Spring" property of the ToolStripStatusLabel and can't do it. Take a look at the last paragraph in my original post.

Thanks,