Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / How do I disable a toolbar button?

How do I disable a toolbar button?

New Discussion
Tony
Tony asked on Jan 8, 2009 4:23 PM

I’m using the following code and get a error message stating “Key not found.”

Here is the code:

 

this.ToolbarsManager.Toolbars[“m_toolBar”].Tools[“Add User”].Control.Enabled = false; 

I’ne also tried

 

this.ToolbarsManager.Toolbars[“m_toolBar”].Tools[“Add User”].SharedProps.Enabled = false;

I’ve put Add User in the tag and in the tag and key including the SharedProps tag.

Can anyone help?

 

Sign In to post a reply

Replies

  • 0
    Mike Dour
    Mike Dour answered on Sep 23, 2008 2:59 PM

    It looks like you have not added a tool with a Key of "Add User" to the toolbar yet. Make sure to add the tool to the toolbar's Tools collection before using these lines of code.

    • 0
      Duane
      Duane answered on Jan 5, 2009 10:58 PM

       I am doing a similar thing in VB and I cannot get the code from tonydavid to work.

      When the app runs and the child form tools merge into the MDI Parent, are the tools still part of the Child ToolsBarManager or are they part of the Parent ToolsBarManager?

      I am putting the code in the child form like this:

       Me.UTM_TCM.Ribbon.ToolbarsManager.Toolbars[0].Tools("Delete").control.Enabled = False

      But "Control" is not a valid property of Tools.  I am using 2008 vol 1.

      What am I doing wrong?

       

      • 0
        Mike Dour
        Mike Dour answered on Jan 7, 2009 6:02 PM

        The Control property is only valid for tools which host other controls, such as ControlContainerTools and PopupControlContainerTools. If you want to disable a normal tool, you should instead set the SharedProps.Enabled property on the tool.

      • 0
        Duane
        Duane answered on Jan 8, 2009 4:23 PM

         I found the proper code:

        me.ultratoolbarsmanager.ribbon.tabitemtoolbar.tools("Delete").sharedprops.enabled = false 

         

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Tony
Favorites
0
Replies
4
Created On
Jan 08, 2009
Last Post
17 years, 1 month ago

Suggested Discussions

Created by

Created on

Jan 8, 2009 4:23 PM

Last activity on

Feb 12, 2026 8:02 PM