Avatar of K-9
K-9 asked on

Access toolstrip items from code behind

I have a vb.net winforms application that has many forms.  I use a bindingnavigator and on that is a label (toolstriplabel).  I have a module which has a public function that I want to update the label from.  Since this is used by multiple forms I need someway of doing this..

What is the correct syntax for to do this?  An example would help greatly.
Visual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon
Andy Marshall

I'm writing my first .Net app at the moment, so apologies if this proves to be utter nonsense...

Could you create a string property in the BindingNavigator class that you could get/set as you need?

        /// <summary>
        /// Holds the selected LabelText for the BindingNavigator.
        /// </summary>
        private string labelText;
        public string LabelText
            get { return this.labelText; }
            set { this.labelText = value; }

Open in new window

Set the BindingNavigator's LabelText property from your function (once you have created an object reference to the BindingNavigator).  You could then refresh the text in your label by getting the BindingNavigator's LabelText property.

Hope this helps - if not, apologies!

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Able to resolve it with this code.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck