Page 1 of 1
Can't get viewer "Close" button reference
Posted: Tue Nov 25, 2008 5:49 pm
by Fabio Pagano
I'm converting from 2008.2 to 2008.3.311.0. In my program that manages the viewer i had this code to get the viewer close button reference:
Code: Select all
Private WithEvents mbtnClose As Stimulsoft.Controls.StiToolButton
...
mbtnClose = TryCast(StiViewerControl1.ToolBar.Controls.Item("tbClose"), Stimulsoft.Controls.StiToolButton)
With 2008.3.311.0 version, using the ribbon gui, the "TryCast(StiViewerControl1.ToolBar.Controls.Item("tbClose"), Stimulsoft.Controls.StiToolButton)" returns nothing. Are there some differences in 2008.3.311.0 version to get the viewer close button reference?
Thank you.
Can't get viewer "Close" button reference
Posted: Fri Nov 28, 2008 12:54 am
by Vital
Hello,
Can you say why you need reference to Close button?
Thank you.
Can't get viewer "Close" button reference
Posted: Fri Nov 28, 2008 8:12 am
by Fabio Pagano
The StiViewer control is contained in a my form. When close button (of the viewer) is pressed i intercept the click event and call a "Me.close" that closes my form.
In my form (that contais the StiViewer control) i have this code:
Code: Select all
'At module level i have mbtnClose variable:
Private WithEvents mbtnClose As Stimulsoft.Controls.StiToolButton
'In the "new" event of the form i assign the reference:
mbtnClose = TryCast(StiViewerControl1.ToolBar.Controls.Item("tbClose"), Stimulsoft.Controls.StiToolButton)
'In 2008.3.311.0 version the mbtnClose remains "nothing", in 2008.2 it worked.
'This is the event:
Private Sub mbtnClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mbtnClose.Click
'Closes the form
Me.Close()
End Sub
I don't know if there is another way to intercept the close on the viewer control and close the container form.
Thank you.
Can't get viewer "Close" button reference
Posted: Fri Nov 28, 2008 11:10 am
by Vital
Hello Fabio,
You can use Close event of StiViewerControl.
Thank you.