Error " Project does not contain static method suitable for and entry Point "

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anouar Seljouki

    #1

    Error " Project does not contain static method suitable for and entry Point "

    1) I built and application that I called contact here is the script for it

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    
    namespace Contacts
    {
    static class Program
    {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void NotMain()
    {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Form1());
    }
    
    2) then the book that I am using to teach my self C# asked me to create a new class and set the 1st entry to NotMain and create a main point on the new class that called Another class and here is the script for it
    
    using System.Windows.Forms;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Contacts
    {
    class AnotherClass
    {
    public static void main()
    {
    MessageBox.Show("Pow!");
    }
    }
    }
    the goal is to set the entry point in the secend class I created but instead C# gives me and error that there is no entry point and it is not recognizing the entry point I am creating. what could I be possibly be doing wrong
    Last edited by NeoPa; Nov 20 '10, 06:29 PM. Reason: Added CODE tags
  • Christian Binder
    Recognized Expert New Member
    • Jan 2008
    • 218

    #2
    It's because you wrote "main" instead of "Main", so just change it to
    Code:
    public static void Main()
    {
      MessageBox.Show("Pow!");
    }
    and it should work.

    Comment

    Working...