Can't get viewer "Close" button reference

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Can't get viewer "Close" button reference

Post 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.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Can't get viewer "Close" button reference

Post by Vital »

Hello,

Can you say why you need reference to Close button?

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Can't get viewer "Close" button reference

Post 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.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Can't get viewer "Close" button reference

Post by Vital »

Hello Fabio,

You can use Close event of StiViewerControl.

Thank you.
Post Reply