Toolbar in MDI Form

How can I execute a procedure from a child form clicking an icon in the toolbar into MDI Form???
guichoAsked:
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.

mcriderCommented:
Let's say you have a procedure on a child form call "Child1" and the procedure is called "MyFunction"...


MyFunction should be declared as public...

Public Sub MyFunction()
'...
End Sub

then in the button, you can call:

Child1.MyFunction


Make sense?

Cheers!
0
guichoAuthor Commented:
The answer is correct, but I've 9 icons in the toolbar, how assign the procedure to the third icon???
0
mcriderCommented:
the 3rd icon has a "Click" event.  Put the call there.

To find the click event, when you're in design mode, double-click your 3rd Icon and a CODE box will pop up... There are 2 dropdown boxes on this code window. make sure the right-most dropdown box says "Click" and then put your call in the subroutine...


Cheers!
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
guichoAuthor Commented:
The first answer was excellent, but in the second I can't select only the third icon click event, I resolved this way from MDIForm...

Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
    If Toolbar1.Buttons(3).Value = tbrUnpressed Then Child1.MyFunction
End Sub

But thank's a lot for your help...
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.