Add menu separator bar at runtime??

Can you add a separator bar at runtime? I seem to having a few problems!

If I do this it fails with "Cannot use separator bar as menu name for this control"

Load OtherHardwareMenu(19)
OtherHardwareMenu(19).Caption = "-"

but if I do this it works!!

Load OtherHardwareMenu(19)
OtherHardwareMenu(19).Caption = NameOfMenuItem"

Thanks,

Dave.
wildarmsdaveAsked:
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.

FER_GCommented:
wildarmsdave
are you sure that 19 is the next value in the array of elements.
Try to compare it whit the next code
OtherHardwareMenu.UBound + 1

I tell you that, because the next code works fine for me

nroMenuArc = mnuArchivoSep.UBound + 1
Load mnuArchivoSep(nroMenuArc)
mnuArchivoSep(nroMenuArc).Enabled = True
mnuArchivoSep(nroMenuArc).Visible = True
mnuArchivoSep(nroMenuArc).Caption = "-"

Regards;
FerG

Saludos
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.
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
wildarmsdaveAuthor Commented:
Thanks my friend! Dave.
0
wildarmsdaveAuthor Commented:
I stupidly wasn't setting the Separator bar to .visible=True! Once I did this the problem went away (of course!) I only realised after looking at your code.. :o)

Dave.
0
FER_GCommented:
oh, I'm glad that you have solve your problem.
Those things usually happend.

Regards;
FerG

Saludos
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Argentina
0
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.