Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
<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.
Posted
Updated 29-Jan-18 18:29pm

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.
 
Share this answer
 
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)
    C#
    public partial class Form1 : Form
  • Designer File
    C#
    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 ());
 
Share this answer
 
Comments
Member 13650651 30-Jan-18 1:21am    
Hi Karthik! Thank you for your solution. I have successfully debugged it :)
Karthik_Mahalingam 30-Jan-18 1:29am    
welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900