I have question , And I hope Found Answer on it soon ,,
Q: How I Can build Subreport by " Vb.net " code and Insert it on Report Before Show it in "Stiviower Control" in Run Time ??
I try write these Code
Code: Select all
Private Function ViewReport(ByVal RptID As Integer) As Boolean
Try
Dim dtRpt As New DataTable
Dim dsRptDesigner As New DataSet
Dim cmd As New Data.SqlClient.SqlCommand
Dim da As New Data.SqlClient.SqlDataAdapter
Dim ds As New DataSet
Dim mRptName, mRptPath, mRptDataPath As String
'Load Strem Report
StiReport1.Load(clsDesign.ConvertToStreem(mBayt))
clsDesign.ConvertToPath(mBayt)
StiReport1.Dictionary.Databases.Clear()
StiReport1.Dictionary.DataSources.Clear()
StiReport1.RegData(ds)
StiReport1.Dictionary.Synchronize()
'Creat Subreport
If dtRpt.Rows(0).Item("WithoutHead") = False Then
Dim HheaderRpt As New Stimulsoft.Report.StiReport
HheaderRpt.Load("C:\mReport.mrt")
StiReport1.SubReports.Add(HheaderRpt)
Dim SubReport1 As New Stimulsoft.Report.Components.StiSubReport
SubReport1.Report = HheaderRpt
StiReport1.Pages.Items(0).Components.AddRange(New Stimulsoft.Report.Components.StiComponent() {SubReport1})
End If
StiViewer.Report = StiReport1
StiViewer.Show()
StiReport1.Render()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Function