2017-02-09 89 views
-1

如何解決此問題?找不到合適的方法來覆蓋錯誤

錯誤2 'School_Software.RptStudents.NewGenerator':發現重寫C中沒有合適的方法:\用戶\用戶\下載\壓縮\ school_software_0 \學校軟件\學校軟件\ RptStudents.cs 33 31學校軟件

下面是我的代碼

namespace School_Software { 

public class RptFinalMarksLedger : ReportClass { 

    public RptFinalMarksLedger() { 
    } 

    public override string ResourceName { 
     get { 
      return "RptFinalMarksLedger.rpt"; 
     } 
     set { 
      // Do nothing 
     } 
    } 

    public override bool NewGenerator { 
     get { 
      return true; 
     } 
     set { 
      // Do nothing 
     } 
    } 

    public override string FullResourceName { 
     get { 
      return "School_Software.RptFinalMarksLedger.rpt"; 
     } 
     set { 
      // Do nothing 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public CrystalDecisions.CrystalReports.Engine.Section Section1 { 
     get { 
      return this.ReportDefinition.Sections[0]; 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public CrystalDecisions.CrystalReports.Engine.Section Section2 { 
     get { 
      return this.ReportDefinition.Sections[1]; 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public CrystalDecisions.CrystalReports.Engine.Section Section3 { 
     get { 
      return this.ReportDefinition.Sections[2]; 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public CrystalDecisions.CrystalReports.Engine.Section Section4 { 
     get { 
      return this.ReportDefinition.Sections[3]; 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public CrystalDecisions.CrystalReports.Engine.Section Section5 { 
     get { 
      return this.ReportDefinition.Sections[4]; 
     } 
    } 
} 

[System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")] 
public class CachedRptFinalMarksLedger : Component, ICachedReport { 

    public CachedRptFinalMarksLedger() { 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public virtual bool IsCacheable { 
     get { 
      return true; 
     } 
     set { 
      // 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public virtual bool ShareDBLogonInfo { 
     get { 
      return false; 
     } 
     set { 
      // 
     } 
    } 

    [Browsable(false)] 
    [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)] 
    public virtual System.TimeSpan CacheTimeOut { 
     get { 
      return CachedReportConstants.DEFAULT_TIMEOUT; 
     } 
     set { 
      // 
     } 
    } 

    public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { 
     RptFinalMarksLedger rpt = new RptFinalMarksLedger(); 
     rpt.Site = this.Site; 
     return rpt; 
    } 

    public virtual string GetCustomizedCacheKey(RequestContext request) { 
     String key = null; 

     return key; 
    } 
} 

}

+0

請看看[如何對提問](http://stackoverflow.com/help/how-to-ask) – swe

+0

公共覆蓋布爾NewGenerator函數不能超越 –

回答

0

您試圖重寫一個屬性(NewGenerator )在基類中沒有定義。

只需卸下override關鍵字:

public bool NewGenerator { 
    get { 
     return true; 
    } 
    set { 
     // Do nothing 
    } 
} 
+0

試過還是不行 –

+0

@kintumickeal現在的錯誤信息是什麼? –

+1

最後它已經工作了,感謝GoTo –

相關問題