sschuman220
asked on
Problem using Crystal Reports in a tab control
I am displaying Crystal Reports in a tabl control. A doc file with a screen print is attached. When Any report is displayed, the box just above the report that says "Main Report" appears. No one here can figure out how to get rid of it. It is under the Crystal Reports toolbar and the Tab that says "Ranking System". The attachment shows one report. There are actually 7 reports to be displayed and they all do the same thing.
public void ShowReport(ReportInfo reportInfo, bool newTab)
{
BeginWorking();
CrystalReportViewer viewer;
if (newTab || (this.tabControl1.TabCount == 0))
{
viewer = GetNewViewer();
}
else
{
viewer = GetCurrentViewer();
ReportClass oldReport = GetCurrentReport();
if (oldReport != null) {
oldReport.Dispose();
}
}
if (viewer == null) { EndWorking(); return; } //error.
if (viewer.Parent is TabPage) {
((TabPage)viewer.Parent).Text = reportInfo.DisplayName;
}
this.Text = "What's New - " + reportInfo.DisplayName;
Type reportType = Assembly.GetExecutingAssembly().GetType(reportInfo.ReportName);
ReportClass report = (ReportClass)Activator.CreateInstance(reportType);
viewer.ReportSource = report;
viewer.Zoom(1);
UpdateSortBar(reportInfo.AllowSort);
EndWorking();
textToSpeech();
}
private CrystalReportViewer GetCurrentViewer()
{
CrystalReportViewer result = null;
try {
foreach (Control control in this.tabControl1.SelectedTab.Controls) {
if (control is CrystalReportViewer) {
result = (CrystalReportViewer)control;
break;
}
}
} catch {
return null;
}
return result;
}
private CrystalReportViewer GetNewViewer()
{
TabPage page = GetNextTab();
CrystalReportViewer viewer = new CrystalReportViewer();
page.Controls.Add(viewer);
viewer.Dock = DockStyle.Fill;
viewer.DisplayGroupTree = false;
viewer.DisplayStatusBar = false;
viewer.EnableDrillDown = false;
viewer.Zoom(1);
return viewer;
}
Crystal-Reports-Problem.doc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER