最佳重载方法匹配错误 [英] Error of best overloaded method match

查看:105
本文介绍了最佳重载方法匹配错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< pre>使用System; 
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Windows.Forms;
使用 FAR_Yield_Analysis_Test_Tool;

命名空间 FARYieldAnalysisTestTool
{
static class 程序
{
/// < 摘要 >
/// 应用程序的主要入口点。
/// < / summary >
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault( false );
Application.Run( new Form1());
}
}
}





嗨。我有一个错误System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext)的最佳重载方法匹配在

 Application.Run(新Form1(新的Form1)中有一些无效的参数)); 



任何想法如何解决这个问题?



我尝试过什么:



我试图将Form1更改为其他文件名但无效。

解决方案

< blockquote>当你重命名文件时,你可能同时重命名了 Form1 类。所以,现在,而不是 Application.Run(new Form1()); ,您必须将Form1替换为表单的实际名称。


确保以下内容具有相同的名称( Form1



  • 表单名称(打开表单 - >属性F4 - > Name属性)

  • 代码文件(打开表单 - >查看代码F7)

      public   partial   class   Form1 :表单

  • 设计师文件

      partial   class   Form1  



如果不起作用,请创建一个新的表格并将相关代码(代码文件+设计师文件代码)从 Form1 添加到新表格并添加表格ID

 Application.Run(new NewFormName()); 


<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using FAR_Yield_Analysis_Test_Tool;

namespace FARYieldAnalysisTestTool
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1 ());
        }
    }
}



Hi. I have an error of "the best overloaded method match for System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext)' has some invalid arguments at "

Application.Run(new Form1 ());

"
Any idea how to solve this?

What I have tried:

I tried to change the Form1 to other filename but to no avail.

解决方案

When you renamed the file, you may have renamed the Form1 class at the same time. So, now, instead of Application.Run(new Form1());, you have to replace Form1 with the actual name of the form.


Make sure the following has the same name (Form1)

  • Form Name(open the form -> property F4 -> Name property )
  • Code File (open the form -> View Code F7)

    public partial class Form1 : Form

  • Designer File

    partial class Form1


if it doesn't work, create a new form and add the relevant code ( Code File + designer File code) from Form1 to new form and add the form id in

Application.Run(new NewFormName ());


这篇关于最佳重载方法匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆