Problem in enabling and disabling menuitem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cravish
    New Member
    • Aug 2007
    • 7

    Problem in enabling and disabling menuitem

    Hi,

    I have an appliction in which,there are many User for whom different accesss right are given for different menuitem.Now, when a user Login in, he/she should have access to those many nos. of menuitems(names stored in database)

    this is the sample of code:

    strQry = "select MenuName from table1 "
    mycommand = New SqlCommand(strQ ry, myConnection)
    dr = mycommand.Execu teReader
    If LCase(g_UserNam e) = "sa" Then
    While dr.Read
    mnuCurr = Me.Controls(dr( 0))
    If mnuCurr Is Nothing Then
    Err.Clear()
    Else
    mnuCurr.Enabled = True
    End If
    End While
    dr.Close()
    End if

    Please Help me....Thanking in advance
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Its better to set some boolean lags after login and then enable the desired menus accordingly. Initially set all the menus desabled.

    Comment

    Working...