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. Menus - is there a better way of doing this .....

Menus - is there a better way of doing this .....

Scheduled Pinned Locked Moved Visual Basic
xmlquestion
2 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
    penguin5000
    wrote on last edited by
    #1

    I'm working with menus at the moment, and I'm reading in the contents of an XML file to create the menu. The number of rows in the DataView I am iterating through is around 190. Adding all these rows to a menu is simple enough, but 190 items on a menu doesn't look good. So, I'd like to break the 190 items into submenus - perhaps 20-ish items on a menu. The bottom option will be "More", and another 20 or so is presented, again with the bottom item "More", and so it continues until all 190 have been accomodated. A snippet of what I've got so far is: ' Sort the DataView by Country dv.Sort = "Country" For Each dvRow In dv view_coun_tsmi.DropDownItems.Add(dvRow("Country")) Next What I think I need is something like: Dim counter As Integer Dim view_coun_tsmi_more As New ToolStripMenuItem For Each dvRow In dv If counter < 21 Then view_coun_tsmi.DropDownItems.Add(dvRow("Country")) End If If counter = 21 Then view_coun_tsmi_more = New ToolStripMenuItem("More ....") view_coun_tsmi.DropDownItems.Add(view_coun_tsmi_more) view_coun_tsmi_more.DropDownItems.Add .... some more options End If counter += 1 Next But this, I think, is a horrible way of doing it. Is there a better way?

    R 1 Reply Last reply
    0
    • P penguin5000

      I'm working with menus at the moment, and I'm reading in the contents of an XML file to create the menu. The number of rows in the DataView I am iterating through is around 190. Adding all these rows to a menu is simple enough, but 190 items on a menu doesn't look good. So, I'd like to break the 190 items into submenus - perhaps 20-ish items on a menu. The bottom option will be "More", and another 20 or so is presented, again with the bottom item "More", and so it continues until all 190 have been accomodated. A snippet of what I've got so far is: ' Sort the DataView by Country dv.Sort = "Country" For Each dvRow In dv view_coun_tsmi.DropDownItems.Add(dvRow("Country")) Next What I think I need is something like: Dim counter As Integer Dim view_coun_tsmi_more As New ToolStripMenuItem For Each dvRow In dv If counter < 21 Then view_coun_tsmi.DropDownItems.Add(dvRow("Country")) End If If counter = 21 Then view_coun_tsmi_more = New ToolStripMenuItem("More ....") view_coun_tsmi.DropDownItems.Add(view_coun_tsmi_more) view_coun_tsmi_more.DropDownItems.Add .... some more options End If counter += 1 Next But this, I think, is a horrible way of doing it. Is there a better way?

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

      What about cascading menus?

      item1
      item2->item1
      item2
      item3
      item4

      He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.

      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