I'm trying to create submenus dynamically using a dataset. For instance, I want to query the database, pull in the names of some reports and insert them under the main heading "Reports". I have done the following leaving in my commented code:
Dim mnuMainMenu As New MainMenu()
Me.Menu = mnuMainMenu
Dim myMainMenu As New MenuItem("Reports")
Dim myMenuItemNew() As MenuItem
mnuMainMenu.MenuItems.Add(myMainMenu)
'myMainMenu.MenuItems.Add(myMenuItemNew)
ds = ws.GetReportTitle()
ReDim myMenuItemNew(ds.Tables("ReportTitle").Rows.Count)
For x = 0 To UBound(myMenuItemNew)
myMenuItemNew(x).Text = x
myMainMenu.MenuItems.Add(myMenuItemNew(x))
Next x
'For x = 0 To ds.Tables("ReportTitle").Rows.Count - 1
' 'Dim myMenuItemNew As MenuItem()
' mnuMainMenu.MenuItems.Add(New MenuItem(ds.Tables("ReportTitle").Rows(x).Item(0)))
'Next x




Reply With Quote