Error using Report Wizard

Stimulsoft Reports.NET discussion
Post Reply
ngaheer
Posts: 44
Joined: Sat Jul 22, 2006 1:12 am
Location: San Jose

Error using Report Wizard

Post by ngaheer »

I m trying to generate a report using the report wizard, i can complete the wizard and at the end, when i click Finish, i get an error. Following is the error message (i m also mentioning the code i used in the method at the bottom)
***************************************************************

System.InvalidOperationException was unhandled
Message="Collection was modified; enumeration operation may not execute."
Source="mscorlib"
StackTrace:
at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
at Stimulsoft.Report.Dictionary.StiDataCollection.RegData(StiDataCollection datas)
at Stimulsoft.Report.StiReport.RegData(StiDataCollection datas)
at SDP.Win.QueryBuilder.ReportDesigner.SetReportWizard() in D:\QueryBuilder2\QueryBuilderControls\Version2\ReportDesigner.vb:line 136
at SDP.Win.QueryBuilder.ReportDesigner.UltraButtonReportWizard_Click(Object sender, EventArgs e) in D:\QueryBuilder2\QueryBuilderControls\Version2\ReportDesigner.vb:line 122
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at SDP.Win.QueryBuilder.App.Main.Main() in D:\QueryBuilder2\QueryBuilderApp\Main.vb:line 3
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

*****************************************************************************************

Code: Select all

Private Sub SetReportWizard()
        Dim report As Stimulsoft.Report.StiReport = PopulateReportDesign()
        Dim outputFieldSet As OutputFieldSet = OutPutFieldSetDataStore.getInstance.find(_reportLayout.RLAOFSID)
        Dim ds As DataSet = ReportExecuter.ExtractSchema(outputFieldSet)
        report.RegData("Data", ds)
        report.Dictionary.Synchronize()
        Dim wizard As Stimulsoft.Report.Design.Wizards.StiStandardWizardService = New Stimulsoft.Report.Design.Wizards.StiStandardWizardService()
        Dim rptNew As Stimulsoft.Report.StiReport = wizard.CreateReport(report)

        If (rptNew IsNot Nothing) Then
            rptNew.RegData(rptNew.Dictionary.DataStore)
            rptNew.Design()
            Dim reportLayout As String = rptNew.SaveToString
            _reportLayout.RLALayout = reportLayout
        End If
    End Sub
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Error using Report Wizard

Post by Edward »

Please delete the following line from your method:

Code: Select all

'rptNew.RegData(rptNew.Dictionary.DataStore)
Thank you.
ngaheer
Posts: 44
Joined: Sat Jul 22, 2006 1:12 am
Location: San Jose

Error using Report Wizard

Post by ngaheer »

Thanks for solving my problem, my report wizard is working very smoothly.

Ok my next step is to add MasterReport to my report. I m trying to set master report on this new report. But all i can see is a very small square in the report designer.The code i applied is as following

Code: Select all

Private Sub SetReportWizard()

        Dim report As Stimulsoft.Report.StiReport = PopulateReportDesign()

        Dim masterReport As New StiReport
        Dim a As String = System.AppDomain.CurrentDomain.BaseDirectory.ToString
        masterReport.Load(a & "Master.mrt")

        Dim outputFieldSet As OutputFieldSet = OutPutFieldSetDataStore.getInstance.find(_reportLayout.RLAOFSID)
        Dim ds As DataSet = ReportExecuter.ExtractSchema(outputFieldSet)
        report.RegData("Data", ds)
        report.Dictionary.Synchronize()
        'report.MasterReport = masterReport.SaveToString()
        Dim wizard As Stimulsoft.Report.Design.Wizards.StiStandardWizardService = New Stimulsoft.Report.Design.Wizards.StiStandardWizardService()
        Dim rptNew As Stimulsoft.Report.StiReport = wizard.CreateReport(report)

        If (rptNew IsNot Nothing) Then
            'rptNew.MasterReport = masterReport.SaveToString()
            rptNew.Design()
            Dim reportLayout As String = rptNew.SaveToString
            _reportLayout.RLALayout = reportLayout
        End If
    End Sub
in the above code u can see that i have tried setting .MasterReport before and after running wizard. I hav commented both the settings now, but i tried each of them alternatively. Kindly suggest how can i set it.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Error using Report Wizard

Post by Edward »

Please try to assign the Master Report as class, not as string:

Code: Select all

MyReport master = new MyReport();
StiReport.ReportType = typeof(MyReport);
Thank you.
Post Reply