2016-06-08 57 views
0

我正在從vb.net應用程序遷移到c#,我用this工具來轉換所有我的代碼方法的方法。但是當我最終編譯代碼時,我找不到合適的方法來覆蓋。沒有合適的方法發現覆蓋從vb.net轉換爲c#

我看着這個類似的帖子No Suitable Method Found To Override

但他使用部分類,但我使用一個內部類 frmMain.cs代碼

namespace RSCWebPoll 
{ 
    internal class frmMain : System.Windows.Forms.Form 
    { 
    const bool IsDebug = false; 

     const short LoopTimeInSeconds = 300; 

     public TFSUtilities.Logger logger = new TFSUtilities.Logger(); 
     public System.DateTime NextPollTime; 
     public string WinDSSStoreName; 
     public string WinDSSStoreNumber; 
     public string WinDSSStoreCity; 
     public string WinDSSStoreState; 
     public string WinDSSRegisterNumber; 
     public string WinDSSTillNumber; 
     public string WinDSSDrawerNumber = "1"; 
     public short RegisterStatus; 
     public string TillSeqType; 
} 
} 

frmMain.Designer.cs

partial class frmMain 
{ 
    #region "Windows Form Designer generated code " 
    [System.Diagnostics.DebuggerNonUserCode()] 
    public frmMain() 
     : base() 
    { 
     //This call is required by the Windows Form Designer. 
     InitializeComponent(); 
    } 
    //Form overrides dispose to clean up the component list. 
    [System.Diagnostics.DebuggerNonUserCode()] 
    /// <summary> 
    /// Required designer variable. 
    /// </summary> 
    private System.ComponentModel.IContainer components = null; 

    /// <summary> 
    /// Clean up any resources being used. 
    /// </summary> 
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 
    protected override void Dispose(bool disposing) 
    { 
     if (disposing && (components != null)) 
     { 
      components.Dispose(); 
     } 
     base.Dispose(disposing); 
    } 
} 

任何幫助非常感謝... enter image description here

+5

我懷疑你的部分類是在不同的命名空間,所以他們沒有得到鏈接在一起。 –

+1

是的,您的frmMain.Designer.cs沒有粘貼到此問題中的名稱空間。你是否在那個文件中四處遊走?它是由VS生成的,所以你不應該碰它。 – Will

+1

命名空間和表單類需要在cs文件和designer.cs文件中相同。此外,項目設置中的默認名稱空間必須與cs文件中的名稱空間相匹配。 – jdweng

回答

0

檢查這兩個files.it的類名會像formx.cs

下面

namespace WindowsFormx 
{ 
    public partial class formx: Form 

formx.designer.cs

namespace WindowsFormx 
{ 
    partial class formx 

designer.cs的檢查命名空間

+0

我已經檢查過,但我在form.designer.cs中使用form.cs和partial類中的內部類 – CodeMan

+0

這兩個類都應該是部分的,只有它可以構建爲一個類 –

相關問題