Toolbar and MDI form

S

Smiles

Hi there. Thanks for help in advance.

I have an mdi form, with a toolbar.
When i click on the toolbar button, i want to call the sub
of "active mdi child" form's "Action" module, with the button.index passed.

for each "mdi child form", i have defined the module:
sub Action(byval buttonIndex as integer)
case of buttonIndex
take the actions
end sub


for VB6, i know how to make it.
however, when i make the test project be upgraded to vb.net,


---------VB6--------------------------------------------------------------------------------
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComCtlLib.Button)
On Error Resume Next
ActiveForm.takeaction (Button.Key)
End Sub

---------.Net--------------------------------------------------------------------------------
Private Sub Toolbar1_ButtonClick(ByVal eventSender As System.Object, ByVal
eventArgs As AxMSComctlLib.IToolbarEvents_ButtonClickEvent) Handles
Toolbar1.ButtonClick
On Error Resume Next
'UPGRADE_ISSUE: Control takeaction could not be resolved because it was
within the generic namespace ActiveMDIChild. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2072"'
ActiveMDIChild.takeaction(eventArgs.Button.Key)
End Sub




Thanks and best regards.
Miles
 
K

Ken Tucker [MVP]

Hi,

There no longer is an index property with the toolbar button. Use
e.button is toolbarbutton then. You can use Me.ActiveMdiChild from the mdi
parent to get the active child

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
ToolBar1.ButtonClick
' Your active mdi child form is Me.ActiveMdiChild
If e.Button Is ToolBarButton1 Then
' do something
ElseIf e.Button Is ToolBarButton2 Then
' do something else
ElseIf e.Button Is ToolBarButton3 Then
' your other code
End If
End Sub


Ken
 
S

Smiles

Thanks, Ken.


my problem is how to call the mdiChild's "take action" module in
the mdiParent form.

Thanks again.

Miles

Thanks and best regards. Miles Hong Full Com i Tech Tel: 2334-1363 (mobile:
60205364) Fax: 2334-8263
 
S

Smiles

Thanks. :)


Private Sub Toolbar1_ButtonClick(ByVal eventSender As System.Object, ByVal
eventArgs As AxMSComctlLib.IToolbarEvents_ButtonClickEvent) Handles
Toolbar1.ButtonClick

me.activeChild.takeAction(e.button)???????????????????

End Sub


Thanks and best regards. Miles Hong Full Com i Tech Tel: 2334-1363 (mobile:
60205364) Fax: 2334-8263
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top