Results 1 to 6 of 6

Thread: disabling menus programatically

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046

    disabling menus programatically

    whats the best way to disable alll menu items on a form programaticallly? is there a collection to loop through?

    Thanks in advance.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: disabling menus programatically

    VB Code:
    1. Dim mnu As Control
    2.     For Each mnu In Me.Controls
    3.         If TypeOf mnu Is Menu Then
    4.            mnu.Enabled = False
    5.         End If
    6.     Next

  3. #3
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Re: disabling menus programatically

    Hack, you beat me to it. I was about to post the exact same code.
    "It's cold gin time again ..."

    Check out my website here.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046

    Re: disabling menus programatically

    excellent!!!
    thanks!

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: disabling menus programatically

    Quote Originally Posted by BruceG
    Hack, you beat me to it. I was about to post the exact same code.
    Me too! I just pressed that F5 button on time.

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: disabling menus programatically

    Just call me "Thunder Fingers"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width