How to find menu item visibility dynamically
-
Hi All, I want to check the menuitem visibilty. Menu items will be coming through recordset and will loop through the recordset. For each menuitem, I want to check the visibility like as follows. frmMain.DefInstance.Controls(rstRef.Fields("cname")).Visible but, abouve code is giving cast error. if we hardcode the menu Item, its working fine. like as follows frmMain.DefInstance.MenuItem1.Visible But, if I want to check the menu item visibilty dynamically, how can I do? Please let me know. Thanks in Advance.
AR Reddy
-
Hi All, I want to check the menuitem visibilty. Menu items will be coming through recordset and will loop through the recordset. For each menuitem, I want to check the visibility like as follows. frmMain.DefInstance.Controls(rstRef.Fields("cname")).Visible but, abouve code is giving cast error. if we hardcode the menu Item, its working fine. like as follows frmMain.DefInstance.MenuItem1.Visible But, if I want to check the menu item visibilty dynamically, how can I do? Please let me know. Thanks in Advance.
AR Reddy
for each mi as menuitem in frmmain.definstance.controls
if mi.visible = true then
'your code
end if
next"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
for each mi as menuitem in frmmain.definstance.controls
if mi.visible = true then
'your code
end if
next"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
-
for each mi as menuitem in frmmain.definstance.controls
if mi.visible = true then
'your code
end if
next"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
Hi Smithers-Jones, With the given code is working fine but, its looping through all the menuitems that are in the form. But I want to checkfor few menus (that will come from recordset) only. so from your given code, if I check mi.Name, Im not getting menu name. like as follows, Dim str as String = recset("cname") for each mi as menuitem in frmmain.definstance.controls if mi.Name == str if mi.visible = true then 'your code end if next So i am not able to check visibility property for few menu items. How can I do this. Please let me know the solution if you get a chance to look into this. Thanks in Advance,
AR Reddy