Report Preview Window

Stimulsoft Reports.NET discussion
Post Reply
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Report Preview Window

Post by satisht »

How to focus report preview window?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Report Preview Window

Post by Edward »

Please set FocusOnLoad property of the Preview control in true.

If you need do this after showing the report please use the following:

Code: Select all

stiPreviewControl.View.Focus();
Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Report Preview Window

Post by satisht »

Report is a StiReport object
I have used both options but it is giving same error
that ' Object Refrence not set to the instance of object."

1. Report.PreviewControl.FocusOnLoad = True
Report.Compile()
Report.Show()


2. Report.Compile()
Report.Show()
Report.PreviewControl.View.Focus()

How should i resolve this?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Report Preview Window

Post by Edward »

satisht wrote:Report is a StiReport object
I have used both options but it is giving same error
that ' Object Refrence not set to the instance of object."

1. Report.PreviewControl.FocusOnLoad = True
Report.Compile()
Report.Show()


2. Report.Compile()
Report.Show()
Report.PreviewControl.View.Focus()

How should i resolve this?
You should to resolve this in the following way:

Code: Select all

stiPreviewControl1.Report = report;
stiPreviewControl1.Focus();
The stiPreviewControl1 is a custom StiPreviewControl which you can use in your Application for providing custom previewing of the report. For more information please see the CustomPreview sample Application from the standard delivery.

But if you do not want using of StiPreviewControl then the preview form of the report may be focused from any other form in your application in the following way:

Code: Select all

        Dim form As Object
        For Each form In Application.OpenForms
            If TypeOf form Is Stimulsoft.Report.Render.StiPreviewForm Then
                TryCast(form, Stimulsoft.Report.Render.StiPreviewForm).Focus()
            End If
        Next
If these solutions are not suitable for your task then please provide me with more information about your goal.

Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Report Preview Window

Post by satisht »

Thanks it works!
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Report Preview Window

Post by Edward »

Let us know if you need any help.

Thank you.
Post Reply