Question

I converted a Vb.Net Form (which was previously written in vb6) with sharpdevelop to c#, now i am getting error that no suitable main method can be found.

Any solutions on this?

best regards

Was it helpful?

Solution

Seem like you'll have to fix the project, or maybe rerun the converter with different settings.

A simple way to fix could be:

  • create a new WinForms project
  • use Add Existing Item to add your form
  • make it the main Form (Project properties)

OTHER TIPS

If you created a C# Windows Forms application, you can find the Main inside Program.cs

EDIT: added sample code Program.cs sample

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace WindowsFormsApplication2

{
    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());
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top