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 get index value of menuitem

how to get index value of menuitem

Scheduled Pinned Locked Moved Visual Basic
databasehelptutorialquestion
5 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.
  • P Offline
    P Offline
    poonams
    wrote on last edited by
    #1

    hi all, anyone help me? i have generated menus at run time.Now i want to disply reports on each menu.But i can't get index value of menu.I have created one click event for the menu but how i can identify the index of menu which is clicked.plz help me.

    poonam

    R 1 Reply Last reply
    0
    • P poonams

      hi all, anyone help me? i have generated menus at run time.Now i want to disply reports on each menu.But i can't get index value of menu.I have created one click event for the menu but how i can identify the index of menu which is clicked.plz help me.

      poonam

      R Offline
      R Offline
      Richard Blythe
      wrote on last edited by
      #2

      I am still confused on what you are trying to accomplish. Are you wanting an index value to determine what report to print? By the way, every control has a Tag variable. You could set integer values in the tag to differentiate betten the menu items. Cheers! Richard

      may your code be error free. (okay, maybe two lines.)

      P 1 Reply Last reply
      0
      • R Richard Blythe

        I am still confused on what you are trying to accomplish. Are you wanting an index value to determine what report to print? By the way, every control has a Tag variable. You could set integer values in the tag to differentiate betten the menu items. Cheers! Richard

        may your code be error free. (okay, maybe two lines.)

        P Offline
        P Offline
        poonams
        wrote on last edited by
        #3

        Hi Richard Hw can i set tag value,Becoz my menus are generating at run time.Thats why i have created event handler.If i don't know which menu is clicked runtime then hw i can show the reports.I need a code which will store index value of a menu which is clicked. by the way thanks for reply

        poonam

        R 1 Reply Last reply
        0
        • P poonams

          Hi Richard Hw can i set tag value,Becoz my menus are generating at run time.Thats why i have created event handler.If i don't know which menu is clicked runtime then hw i can show the reports.I need a code which will store index value of a menu which is clicked. by the way thanks for reply

          poonam

          R Offline
          R Offline
          Richard Blythe
          wrote on last edited by
          #4

          Please post the code of how the menus are dynamically generated.

          may your code be error free. (okay, maybe two lines.)

          P 1 Reply Last reply
          0
          • R Richard Blythe

            Please post the code of how the menus are dynamically generated.

            may your code be error free. (okay, maybe two lines.)

            P Offline
            P Offline
            poonams
            wrote on last edited by
            #5

            [code] Dim mShowMenuItem As System.Windows.Forms.MenuItem mShowMenuItem = DirectCast(sender, System.Windows.Forms.MenuItem) mShowMenuItem.MenuItems.Clear() Dim n, i As Integer Dim a, b As String s = "Select srno from cash" com = New OleDbCommand(s, con) con.Open() dr = com.ExecuteReader While dr.Read n = dr(0) End While con.Close() For i = 1 To n s = "Select account from cash" com = New OleDbCommand(s, con) con.Open() dr = com.ExecuteReader While dr.Read() a = dr(0) Dim mSubSubMenuItem As System.Windows.Forms.MenuItem mSubSubMenuItem = New System.Windows.Forms.MenuItem mSubSubMenuItem.Index = i mSubSubMenuItem.Text = a mSubSubMenuItem.Enabled = True mSubSubMenuItem.Visible = True AddHandler mSubSubMenuItem.Click, AddressOf MenuClickHandler mShowMenuItem.MenuItems.Add(mSubSubMenuItem) i = i + 1 End While con.Close() Next this will generate menus Public Sub MenuClickHandler(ByVal Sender As Object, ByVal e As System.EventArgs) 'Don't know wt to write here End Sub

            poonam

            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