Toolbar buttons

vnarod

Regular
Joined
Mar 22, 2002
Messages
84
Is there a way to simulate a click of toolbar button from code?

I do not mean visually, I just need to execute code in that event.
 
Just call the handler sub from code. You need to pass an EventArgs
object though. Like this:
Visual Basic:
    Private Sub ButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim eArgs As New ToolBarButtonClickEventArgs(ToolBarButton2)

        ToolBar1_ButtonClick(ToolBar1, eArgs)
    End Sub
 
The problem is that I am trying to get at Toolbar from CrystalViewer. Where is no Toolbar property. I can get to it only like this:

for each c in crv.controls
if TypeOf c is ToolBar then
tb=c
exit for
end if
next

No, how do I call ButtonClick event for tb?
 
Back
Top