Menus - is there a better way of doing this .....
-
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? -
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?What about cascading menus?
item1
item2->item1
item2
item3
item4He was a snowflake, like other "unique" snowflakes, falling down, getting stepped on, and pushed aside to disappear.