2016-06-08 64 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

这两个类都应该是部分的,只有它可以构建为一个类 –

相关问题