Toolbar in MDI Form

How can I execute a procedure from a child form clicking an icon in the toolbar into MDI Form???
Who is Participating?
mcriderConnect With a Mentor Commented:
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...

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:


Make sense?

guichoAuthor Commented:
The answer is correct, but I've 9 icons in the toolbar, how assign the procedure to the third icon???
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...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.