我的窗体(main)有两个菜单:mnu1和mnu2,想在登录时用两个权限(1,2)实现两个菜单的显示.
具体是:为1时两个菜单都显示,为2时mnu2不显示.请问如何控制?

解决方案 »

  1.   

    刚好我也问过此类问题,在程序中加一句就可(为2时):
    main!mnuS.Enabled=False
      

  2.   

    if power=1 thenmenu1.enabled=true
    menu2.enabled=true
    else
    menu1.enabled=true
    menu2.enabled=false
    end if
      

  3.   

    main!mnuS.Enabled=False
    没错,我试了OK
      

  4.   

    登陆界面写代码:
      Option ExplicitPublic LoginSucceeded As IntegerPrivate Sub cmdCancel_Click()
        LoginSucceeded = 0
        frmMain.txtMenu1.Visible = False
        frmMain.txtMenu2.Visible = False
        Me.Hide
        frmMain.Show
    End SubPrivate Sub cmdOK_Click()
        If txtUserName = "User1" And txtPassword = "password1" Then
           LoginSucceeded = 1
           frmMain.Show
           frmMain.txtMenu1.Visible = True
           frmMain.txtMenu2.Visible = True
           Me.Hide
        ElseIf txtUserName = "User2" And txtPassword = "password2" Then
           LoginSucceeded = 2
           frmMain.Show
           frmMain.txtMenu1.Visible = True
           frmMain.txtMenu2.Visible = False
           Me.Hide
           
        Else
           LoginSucceeded = 0
           frmMain.Show
           frmMain.txtMenu1.Visible = False
           frmMain.txtMenu2.Visible = False
           Me.Hide
        End If
        
    End Sub
      

  5.   

    密码为2 时:
    If txtUserName.Text = "2" And txtPassword.Text = "2" Then
              MsgBox "欢迎!", vbOKOnly + vbInformation, "欢迎"
              LoginSucceeded = True
              main!mnu2.Enabled=False
              Unload Me