Link to home
Start Free TrialLog in
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.
Avatar of Andy Marshall
Andy Marshall
Flag of United Kingdom of Great Britain and Northern Ireland image

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!
ASKER CERTIFIED SOLUTION
Avatar of K-9
K-9

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 K-9
K-9

ASKER

Able to resolve it with this code.