Gobliins
Gobliins

Reputation: 4026

Where is the main method after converting a vb.net form to c#?

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

Upvotes: 0

Views: 443

Answers (2)

Henk Holterman
Henk Holterman

Reputation: 273484

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)

Upvotes: 1

bart s
bart s

Reputation: 5100

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());
        }
    }
}

Upvotes: 1

Related Questions