I have a menu wich contains a submenu

Help --> Motive -- About , 1 , 2 , 3 , 4 , etc... 22

I have the items About, 1 , 2 , 3 , etc all in a menu control array
because I want to be able to click on one of them and FormHelp comes up and displays a message in its text box related to the item clicked.

all of the items are called m1

However, I am having trouble finding the property which designates the item clicked m1(x) as being clicked.
For example if I click About, i want the m1(0) string to come up, but if I click 1, I want the m1(1) caption to come up.
Heres what I have...


Private Sub m1_Click(Index As Integer)

If Index = 0 Then
m1(0).Caption = m1(0).Caption
End If
If Index = 1 Then
m1(1).Caption = m1(1).Caption
End If

'For i = 0 To 11
 ' If (m1(Index).Index = i) Then
 '   m1(i).Caption = m1(Index).Caption
 '   Exit For
 ' End If
'Next i


end sub


Private Sub Form_Load()

'motiv(x) is a global variable as string each containing different
'text sentances

For i = 0 To 11
   Select Case frmForm1.m1(i).Caption
 'I used caption because I thought it would work
 'with some previous code but it doesnt tell the form which
 ' menu item in the menu item array was clicked

       Case "About"
        txtHelp.Text = motiv(0)
        Exit For
       Case "1"
        txtHelp.Text = motiv(1)
        Exit For
       Case "2"
        txtHelp.Text = motiv(2)
        Exit For
       Case "3"
        txtHelp.Text = motiv(3)
        Exit For
       Case "4"
        txtHelp.Text = motiv(4)
        Exit For
       Case "5"
        txtHelp.Text = motiv(5)
        Exit For
       Case "6"
        txtHelp.Text = motiv(6)
        Exit For
       Case "7"
        txtHelp.Text = motiv(7)
        Exit For
       Case "8"
        txtHelp.Text = motiv(8)
        Exit For
       Case "9"
        txtHelp.Text = motiv(9)
        Exit For
       Case "11"
        txtHelp.Text = motiv(11)
        Exit For
       Case "22"
        txtHelp.Text = motiv(12)
        Exit For
    End Select
Next i
End Sub

Thank you to anyone who can help me
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.

Hi, why do you write the same thing:
m1(0).Caption = m1(0).Caption
m1(0).Caption will always = itself.
Éric MoreauSenior .Net ConsultantCommented:
The "index" returns the value of the selected menu item.

Private Sub m1_Click(Index As Integer)

msgbox m1(index).caption

end sub

Do this:

                 Private Sub m1_Click(Index As Integer)

                 frmHelp. txtHelp.Text = motiv(Index)

                 end sub
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

CRAZYAuthor Commented:
Dalin had the right answer.
I was going to do that but for some reason I thought that you couldnt set the txtHelp.text property until the form was loaded and that after the form is loaded you couldnt set the text property using the m1_click event.

Thanks a lot Lock the question if u want points
Éric MoreauSenior .Net ConsultantCommented:
You can accept dalin comment even if it is not locked as an answer.

Check to the right of the "Comment" word, you should see a "accept as an answer".
Make sure your submenu is index (ie if you are loading it dynamically with only one to start, make sure it is indexed) - then you will be able to refer to the index.


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.