Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. window form application

window form application

Scheduled Pinned Locked Moved Windows Forms
helptutorial
8 Posts 6 Posters 31 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ANKIT KUMAR SINHA
    wrote on last edited by
    #1

    I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

    L G S M 5 Replies Last reply
    0
    • A ANKIT KUMAR SINHA

      I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please show the actual code that is not working and explain in detail. No one can guess what your code does.

      Veni, vidi, abiit domum

      1 Reply Last reply
      0
      • A ANKIT KUMAR SINHA

        I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        ANKIT KUMAR SINHA wrote:

        if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item

        Instead of disabling the menu-item, I'd recommend not creating it in the first place.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        • A ANKIT KUMAR SINHA

          I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

          G Offline
          G Offline
          Gil B
          wrote on last edited by
          #4

          Try creating a variable in the login form, when any of them logs in assign a value to that variable. Note: the value assigned should be different depending on who logged in. E.g (variable_name = 1..when admin logs in, variable_name = 2..when user logs in ). On the load event of the main form use an if statement to check the value of that variable. Depending on the value of the variable disable the menustrip item using the its name. Example when a normal user logs in If(variable_name=1) { Menustripitem_name.enable=false; } Remember to declare the variables for validation as static variables in the login form so as to access it in the mainform. Hope that works

          A 1 Reply Last reply
          0
          • G Gil B

            Try creating a variable in the login form, when any of them logs in assign a value to that variable. Note: the value assigned should be different depending on who logged in. E.g (variable_name = 1..when admin logs in, variable_name = 2..when user logs in ). On the load event of the main form use an if statement to check the value of that variable. Depending on the value of the variable disable the menustrip item using the its name. Example when a normal user logs in If(variable_name=1) { Menustripitem_name.enable=false; } Remember to declare the variables for validation as static variables in the login form so as to access it in the mainform. Hope that works

            A Offline
            A Offline
            ANKIT KUMAR SINHA
            wrote on last edited by
            #5

            Thanks. I also solve this problem but my procedure is different first i MDI Parent form menustrip itme property change the modifier it declared public and then i access this menu strip in other form like login form. step:1 menustripitem property = public step:2 creating an object the login form step:3 object.menustripitem.Enabled = false; it working properly

            S 1 Reply Last reply
            0
            • A ANKIT KUMAR SINHA

              Thanks. I also solve this problem but my procedure is different first i MDI Parent form menustrip itme property change the modifier it declared public and then i access this menu strip in other form like login form. step:1 menustripitem property = public step:2 creating an object the login form step:3 object.menustripitem.Enabled = false; it working properly

              S Offline
              S Offline
              Simon_Whale
              wrote on last edited by
              #6

              you also realise that you can merge menu's from the child forms into the parent container? Google : MDI Parent form merge menustrip[^]

              Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

              1 Reply Last reply
              0
              • A ANKIT KUMAR SINHA

                I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

                S Offline
                S Offline
                sankarsan parida
                wrote on last edited by
                #7

                check it userwise if(user =="admin"){ menu.IsEnable=true; } else {menu.IsEnable=false;} something like this

                Sankarsan Parida

                1 Reply Last reply
                0
                • A ANKIT KUMAR SINHA

                  I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.

                  M Offline
                  M Offline
                  Member 9986689 PandaLion98
                  wrote on last edited by
                  #8

                  Try making a Boolean variable. On login, the app must determine if the logged in user is admin or not. Then, set the appropriate values.

                  On login:
                  If user is admin: adminbool = true
                  else
                  adminbool = false

                  On form_load
                  If(adminbool=false)
                  {
                  Menustripitem_name.enable=false;
                  }

                  else

                  {
                  Menustripitem_name.enable=true;
                  }

                  You get the idea, right?

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups