In the first case I am Loading the Report using a function then assigning it to the Designer.Report property like so:
Code: Select all
private void GlobalEvents_OpenRecentFileInDesigner(object sender, StiOpenRecentFileObjectEventArgs e)
{
///////////
// Data
///////////
#region Data
StiDesignerControl Designer;
#endregion
///////////
// Code
///////////
#region Code
Designer = (StiDesignerControl)sender;
if (Designer.Report != null)
{
//Destroy Currently Open Report if it Exists
Designer.Report.Dispose();
//Designer.Report = null; //Setting the report to null causes an exception
}
Designer.Report = LoadReport(e.FileName);
}
However if I do the following nothing is loaded into the dictionary.
Code: Select all
private void GlobalEvents_OpenRecentFileInDesigner(object sender, StiOpenRecentFileObjectEventArgs e)
{
///////////
// Data
///////////
#region Data
StiDesignerControl Designer;
#endregion
///////////
// Code
///////////
#region Code
Designer = (StiDesignerControl)sender;
if (Designer.Report != null)
{
//Destroy Currently Open Report if it Exists
Designer.Report.Dispose();
//Designer.Report = null; //Setting the report to null causes an exception
}
//Set Class Property
ReportName = e.FileName;
Designer.Report = new StiReport();
Designer.Report.LoadFromString(LoadReportString());
StiOptions.Designer.DesignerTitle = "POSitive Report Designer - " + ReportName;
StiOptions.Designer.DesignerTitleText = "POSitive Report Designer - " + ReportName;
//Add Variables to Dictiony
MakeParameters(_ReportParams, Designer.Report);
Designer.Refresh();
#endregion
}
Keep in mind that at this point the designer was already open with a currently registered data connections etc. Also the report I am trying to load always has my registered data connections saved with it.
Also, a quick comment on both of these fragments. I am destroying any open reports first due to the possibility that someone will close the current report before opening a new one. In this case I will need to create a new report as Designer.Report will be null. To make my code more consistent I make sure Designer.Report always starts null before I begin loading a new report.
I am at a loss as how to proceed with this. If you guys could help me that would be great.