Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a string to menu object? 2

Status
Not open for further replies.

ebeesam

Programmer
Jan 23, 2003
7
0
0
IN
[tt]Hello all,

In my recent project, i have a security option to display only those selected menus that the user has access to. The administrator gives permission for each user to use a particular menu command, and that menu is only shown when he logs in.

For that i had to store all the menunames in a table and retreive the names when the user logs in.
But when i take this menunames back and store in to an array say menuNames(), how can i say

menuNames(i).visible=true ?????

Do i need to convert the menu name to a menu object? but how?

Please help.

Thanks in advance..
[/tt]
 
dim tmpCtrl as Control
.
.
.
For each tmpCtrl in Me.Controls
If TypeOf tmpCtrl is Menu Then
'check tmpCtrl.Name agianst your list
'if not in your list tmpCtrl.visible = fals
End If
Next
 
Thanks SemperFiDownUnda ...

PraveenMenon helped me as well....

 
Thanks a lot SemperFiDownUnda, its a good thing that I type the right words on my search.

I also need this one.


Please pardon the grammar.
Not good in english.
 
here is my code below

Private Sub LoadCurrentMenus()
Dim Cntrl As Control
Dim lstT As ListItem

For Each Cntrl In mdiMainForm.Controls
If TypeOf Cntrl Is Menu Then
Set lstT = Me.lvwMenus.ListItems.Add(, , Cntrl.Name)
With lstT
.SubItems(1) = Cntrl.Caption
End With
End If
Next

End Sub


But this will just load all the menus in the listview. And this is just a test to get all the menus caption and name. I really want to enhance this to load all menu in a treeview with a checkbox that when the user check a specific menu, that particular menu will be the only one that will be visible to the users.

My question, "Is there a way that i can get the level/hierarchy of the menus?"

Can you help me on this please.


Please pardon the grammar.
Not good in english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top