Toolstrip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • daveL

    Toolstrip

    Hi
    I have a Toolstrip on a Window with 5 buttons

    i want to send this to a application static fucnction
    to enable / disable the buttons based on User rights

    When i send Window.controls to the method
    buttons dont exists in the Controls Collection

    When i work with the Toolstrip i can't see any controls
    how to see the controls attatched to the Toolstrip


    Thanks
    DaveL


  • Ashutosh Bhawasinka

    #2
    Re: Toolstrip

    Controls on the ToolStrip exists in the Control collection of the
    ToolStrip and not the underlying form.
    you can access the controls on the tool strip from it's Items property.

    The buttons(& other controls) on these tool strip exist as a member of
    the underlying form but are not in it's control collection.

    If you are calling this static method before any instance of the class
    is being created, its better to create some static fields in the same
    class which will indicate which buttons to enable/disable. Now on the
    form load event check these fields and enable/disable the buttons
    accordingly. To enable/disable the buttons you don't have to worry about
    the last two statements above.

    Thanks & Regards,
    Ashutosh Bhawasinka

    daveL wrote:
    Hi
    I have a Toolstrip on a Window with 5 buttons
    >
    i want to send this to a application static fucnction
    to enable / disable the buttons based on User rights
    >
    When i send Window.controls to the method
    buttons dont exists in the Controls Collection
    >
    When i work with the Toolstrip i can't see any controls
    how to see the controls attatched to the Toolstrip
    >
    >
    Thanks
    DaveL
    >
    >
    >

    Comment

    • DaveL

      #3
      Re: Toolstrip

      Thank you much
      davel
      "Ashutosh Bhawasinka" <discussion@ash utosh.inwrote in message
      news:ek0Lht5NJH A.1144@TK2MSFTN GP05.phx.gbl...
      Controls on the ToolStrip exists in the Control collection of the
      ToolStrip and not the underlying form.
      you can access the controls on the tool strip from it's Items property.
      >
      The buttons(& other controls) on these tool strip exist as a member of the
      underlying form but are not in it's control collection.
      >
      If you are calling this static method before any instance of the class is
      being created, its better to create some static fields in the same class
      which will indicate which buttons to enable/disable. Now on the form load
      event check these fields and enable/disable the buttons accordingly. To
      enable/disable the buttons you don't have to worry about the last two
      statements above.
      >
      Thanks & Regards,
      Ashutosh Bhawasinka
      >
      daveL wrote:
      >Hi
      >I have a Toolstrip on a Window with 5 buttons
      >>
      >i want to send this to a application static fucnction
      >to enable / disable the buttons based on User rights
      >>
      >When i send Window.controls to the method
      >buttons dont exists in the Controls Collection
      >>
      >When i work with the Toolstrip i can't see any controls
      >how to see the controls attatched to the Toolstrip
      >>
      >>
      >Thanks
      >DaveL
      >>
      >>
      >>

      Comment

      Working...