By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,476 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,476 IT Pros & Developers. It's quick & easy.

n levels dynamic menu

P: n/a
I'm trying to make a dynamic menu loading menuitems from a db.

I managed to do this:

Dim mnuPrincipal As New MainMenu

For intContador = 0 To 5

Dim mnuItem As New clsMenuItem
mnuItem.Index = intContador
mnuItem.Text = Cstr(intContador)
If intContador = 3 Then mnuItem.Enabled = False
AddHandler mnuItem.Click, AddressOf Me.mnuPrincipal_Click

For intContador2 = 0 To 5

Dim mnuSubItem As New clsMenuItem
mnuSubItem.Text = Cstr(intContador)
'// PROBLEM------
mnuPrincipal.MenuItems(intContador).MenuItems.Add( mnuSubItem)
'// PROBLEM------
AddHandler mnuSubItem.Click, AddressOf

Me.Menu = mnuPrincipal

This work great, but I don't know how to 'automate' the line between '//
PROBLEM------, how can I make more
..MenuItems(X).MenuItems(Y).MenuItems(Z).MenuItems .Add(mnuSubItem) dynamic ?

Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.