Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to find menu item visibility dynamically

How to find menu item visibility dynamically

Scheduled Pinned Locked Moved Visual Basic
questionhelptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AR Reddy
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • A 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

      S Offline
      S Offline
      Smithers Jones
      wrote on last edited by
      #2

      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)

      A 2 Replies Last reply
      0
      • S Smithers Jones

        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)

        A Offline
        A Offline
        AR Reddy
        wrote on last edited by
        #3

        Hi Jones, Thanks a lot. Its working with little bit modifications. Thanks again.

        AR Reddy

        1 Reply Last reply
        0
        • S Smithers Jones

          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)

          A Offline
          A Offline
          AR Reddy
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups