enable mdi menus at runtime

itf

New member
Joined
Dec 26, 2008
Messages
4
Programming Experience
Beginner
Dear Experts ,
How to enable mdi menus at runtime depending upon the access rights to user after login.

I have a table in sql server 2000 as
select menuid from user_rights where userid = id
result : 1,3,5,10,15

now in mdi, in menustrip, for each toolstripmenuitem, i have mentioned a menuid in tag property.

I'm new to vb.net
Kindly advice , Thanks in Advance
 
You enable and disable a ToolStripMenuItem by setting its Enabled property to True or False.

I would forgo setting the Tag properties and simply create a Dictionary(Of Integer, ToolStripMenuItem). You can then simply run through the IDs, get the menu item from the Dictionary and set its Enabled property.
 
in vb 6.0 what i used to do was like this :

If rs.State = 1 Then
rs.Close
End If
qry = "select menu_id from user_rights where user_id = '" & id & "' order by menu_id"
rs.Open qry, conn, adOpenDynamic, adLockOptimistic

While rs.EOF = False
For Each m In Me
If TypeOf m Is Menu Then
If Trim(m.HelpContextID) = rs(0) Then
m.Enabled = True
rs.MoveNext
End If
End If
Next
Wend

can i get to do something similar in vb.net 2005 ?
 
kindly help

I'm not able to find how to do this...!
I'll explain about the requirement..
i have a table in sql2000 which has col username and id(this id i want to match to tag property of toolstripmenuitem)
in vb.net2005, i have one menustrip in mdi, where for each toolstripmenuitem there is a tag number .
now i want to disable all the menuitems and subitems at first and then enable only those items which match the id as per the username in table .
I hope this is clear.

Kindly help !
 
Back
Top