Accessing objects at runtime

DerekC

Member
Joined
May 5, 2009
Messages
20
Programming Experience
5-10
Hi,
I need to dynamically access a bindingnavigator, is this possible? I basically want to have code in my Base form which enables or disables it's descendant's menu buttons depending on access rights. Any help would be appreciated.

Thanks.
 
You're going to have to provide more information. Is the BindingNavigator on the base or derived form? How is a ToolStripButton identified as being available for a particular user?
 
Hi,
The bindingnavigator is on the derived form. In the base I want to disable the Add button depending on access rights.

For example, the user is not allowed add a new customer, but the user is allowed add a new product. There is a property on the base form called ADDACCESS. This is set to True or false depending on user permissions. Depending on this I would like to disable/enable the ADD button on the menu of the derived form. I remember I did something similar in Powerbuilder some time back, like 'menu.dynamic addbutton.enable = false'. This would compile at runtime.

Any help would be appreciated, thanks.
 
You should make the property Overridable and then you can simply override it in the derived class and add the desired functionality to the setter. When the base class sets the property it will be the most derived implementation that gets invoked. If a derived class has overridden the property then it's that override that will be invoked, otherwise the base implementation will be invoked.
 
Last edited:
You should make the property Overridable and then you can simply override it in the base class and add the desired functionality to the setter. When the base class sets the property it will be the most derived implementation that gets invoked. If a derived class has overridden the property then it's that override that will be invoked, otherwise the base implementation will be invoked.
I will try, thanks.
 
Back
Top