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;
        }

Open in new window

Crystal-Reports-Problem.doc
sschuman220Asked:
Who is Participating?
 
mokuleConnect With a Mentor Commented:
Look into this blog.
http://bloggingabout.net/blogs/jschreuder/archive/2005/08/03/8760.aspx
There is a solution You needed.
0
 
sschuman220Author Commented:
Thank you, Thank you!!! It worked great.  I wish all my coding problems were this easy to solve.
0
All Courses

From novice to tech pro — start learning today.