How should I set modal propery to false

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

How should I set modal propery to false

Post by satisht »

I have shown form as
Using form As Stimulsoft.Report.Render.StiPreviewForm = New Stimulsoft.Report.Render.StiPreviewForm(Report)
Dim stiPreview As Stimulsoft.Report.Render.StiPreviewControl = form.PreviewControl
Dim tb As StiToolBar = stiPreview.ToolBar
Dim btnSave As StiToolButton = TryCast(tb.Controls.Item("tbSave"), StiToolButton)
Dim btnExport As StiToolButton = TryCast(tb.Controls.Item("tbExport"), StiToolButton)
btnExport.Image = btnSave.Image
Report.Compile()
Report.Render()
form.ShowDialog()
End using
So how should i set modal propery false, it is read only , if I use form.show then form gets closed automaticall?
what will be the solution?
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

How should I set modal propery to false

Post by Brendan »

The reason your preview window is closing after calling show is because you have your preview form in a Using code block. this means that after the Show(), your code exits the Using block and it automatically disposes the preview form for you.
When you show Dialog forms in your application it is best practice to dispose of them once they close.
However since you need to show the preview form in a non modal fashion you should try this code:

Code: Select all

Dim form As New Stimulsoft.Report.Render.StiPreviewForm(Report)
Dim stiPreview As Stimulsoft.Report.Render.StiPreviewControl = form.PreviewControl
Dim tb As StiToolBar = stiPreview.ToolBar
Dim btnSave As StiToolButton = TryCast(tb.Controls.Item("tbSave"), StiToolButton)
Dim btnExport As StiToolButton = TryCast(tb.Controls.Item("tbExport"), StiToolButton)
btnExport.Image = btnSave.Image
Report.Compile()
Report.Render()
form.Show()
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

How should I set modal propery to false

Post by satisht »

Thank You.
Post Reply