Results 1 to 3 of 3

Thread: Disable items in menu

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    73

    Disable items in menu

    I have ceated some stuf in menu editor and now I'd like to disable or hide some stuf in menu bar.
    When I enter my password I'd like to see everything in menu bar. But when some other is running this program with different password it should only see some and not everything. So I'm thinking to somehow disable or. hide some stuf at startup and be enabled or shown only if admin pass is entered...

    So is it possible to do that in code ?

    Thank you!

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

    Re: Disable items in menu

    Conditionally set the Enabled property in a procedure as and when relevent.
    You may also hide it by setting the Visible property, though it is not a recommended technique as users might start wondering where something has vanished.

    vb Code:
    1. MenuName.Enabled = False    'MenuName is the Name of menu/menuItem

    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...

  3. #3
    Hyperactive Member jp26198926's Avatar
    Join Date
    Sep 2008
    Location
    General Santos City, Philippines
    Posts
    310

    Question Re: Disable items in menu

    Code:
    Private Sub Form_Load()
    Dim Admin As String
    
    Admin = InputBox("Please Enter a Password", "Password")
    If Admin = "administrator" Then
        mnuAdmin.Enabled = True
    Else
        mnuAdmin.Enabled = False
    End If
    End Sub
    █ jaypee █
    Attached Files Attached Files

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