Dynamic menus

Can we in VB6 dynamically add to a menu control array and if so is there a limit of elements we can add to the array? If can, please snippets of code.
Thanks,
Mediatek01
mediatek01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

avitalkCommented:
a menu array is like any other control array.  you insert the first element in design time and the rest you can put in at run time.

I don't know if there's a limit, I think the only limit in this case would be display problems.
I added 100 items, there was no error

but i simply couldn't see then all.

open a new form, insert two menu items:
first is mnuFather
and the second is a sub menu - mnuDyn, with index = 0

here's the code:

Private Sub Command1_Click()
Dim count As Long, I As Long, NewIndex As Long

count = 30
For I = 1 To count
    NewIndex = mnuDyn.LBound + I
    Load mnuDyn(NewIndex)
    mnuDyn(NewIndex).Caption =  _
         "Dynamic" & CStr(NewIndex + 1)
    mnuDyn(NewIndex).Visible = True
Next
End Sub

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.