Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 24th, 2006, 5:36 PM   #1
aff1993
Newbie
 
aff1993's Avatar
 
Join Date: Oct 2006
Location: Australia
Posts: 9
Rep Power: 0 aff1993 is an unknown quantity at this point
Send a message via MSN to aff1993
Exclamation Error CS5001 while compiling, i have no idea!

Hello,
I am new to C# so please dont reply using confusing language, i have made a program but everytime i debug i get 1 error saying:

Build started.
Compiling IconEditor
error CS5001: Program 'c:\Documents and Settings\Tony\My Documents\SallyIDE C#\Sally IDE Source Code\IconEditor\obj\Debug\TestProject.exe' does not contain a static 'Main' method suitable for an entry point
Build failed.

Now, the area where i believe code is is here:



public class MyApplication
{
public static MainForm MyMainForm=null;
private static string moduleDir="";
[STAThread]
public static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.DoEvents();
moduleDir=Path.GetDirectoryName(Application.ExecutablePath);
MyMainForm=new MainForm();

if (args.Length>0)
{
string ext=Path.GetExtension(args[0]).ToLower();
if (ext==Globals.ProjectExtension) MyMainForm.LoadProject(args[0]);
else if (ext==Globals.SolutionExtension) MyMainForm.LoadSolution(args[0]);
}
Application.Run(MyMainForm);
}
public static string ModuleDir {
get {
return moduleDir;
}
}

}






I dont know how to fix it i just need some help, if you need anymore code, or if you could be really nice and take my source and fix it, that would be great, just message me. Thanks:banana:
aff1993 is offline   Reply With Quote
Old Oct 24th, 2006, 5:58 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Please read the forum's rules/FAQ, particularly with regard to the use of code tags. It's the polite thing to do when you join a community to ask for help.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 24th, 2006, 7:28 PM   #3
Samuaijack
Programmer
 
Samuaijack's Avatar
 
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 76
Rep Power: 3 Samuaijack is on a distinguished road
>>>Application.Run(MyMainForm);

try entering new before MyMainForm:
Application.Run(new MyMainForm());
Samuaijack is offline   Reply With Quote
Old Oct 25th, 2006, 3:28 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
That's not it, Samuaijack. MyMainForm is an reference to an object, rather than a class.

It would help if the author used code tags, but I don't see anything wrong with the program itself. I suspect something is wrong with the configuration of aff1993's IDE.

My advice would be to try and first get a simple Hello World console program compiling, and then move on from there.
Arevos is offline   Reply With Quote
Old Oct 25th, 2006, 7:57 AM   #5
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
There a reason you have a space (Execut ablePath) in this line?

moduleDir=Path.GetDirectoryName(Application.Execut ablePath);

Or is that just how it posted in for some reason?
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Oct 25th, 2006, 1:02 PM   #6
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Probably how it was posted. The forum software splits up continuous sequences of characters longer than 50 characters. Also, the error raised by the compiler doesn't appear to indicate a syntax error.
Arevos is offline   Reply With Quote
Old Oct 25th, 2006, 2:14 PM   #7
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Thnx Arevos, it was just something that caught my attention off hand... odd how the forum software does that.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Oct 25th, 2006, 2:46 PM   #8
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 4 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
I think its to stop the page streching.

Maybe it doesn't split words up in code tags.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Oct 25th, 2006, 3:00 PM   #9
peace_of_mind
Professional Programmer
 
peace_of_mind's Avatar
 
Join Date: Sep 2004
Location: Hell if I know most of the time
Posts: 439
Rep Power: 5 peace_of_mind is on a distinguished road
Send a message via MSN to peace_of_mind Send a message via Yahoo to peace_of_mind
Quote:
Originally Posted by coldDeath View Post
I think its to stop the page streching.

Maybe it doesn't split words up in code tags.
If he had used them, we'd know the answer.

moduleDir=Path.GetDirectoryName(Application.ExecutablePath); (So we'd know if the OP put the space in or not. I took the space out before posting.)
__________________
Amateurs built the ark
Professionals built the Titanic


Last edited by peace_of_mind; Oct 25th, 2006 at 3:02 PM. Reason: To see if the space was intentional or not
peace_of_mind is offline   Reply With Quote
Old Oct 25th, 2006, 3:49 PM   #10
pal
Programmer
 
pal's Avatar
 
Join Date: Mar 2005
Location: Washington
Posts: 90
Rep Power: 4 pal is on a distinguished road
This should run, it will pop up a window, and print out the application path on the command line.
I wasn't sure what the codes that I commented were suppose to do...

using System;
using System.Windows.Forms;
using System.IO;

public class Exercise : System.Windows.Forms.Form {

    // Application's path
    private static string moduleDir = "";

    // Application instantiation
    private static Exercise MyMainForm = new Exercise();

    // Set and return a directory path in moduleDir variable
    public static string ModuleDir {
        set {
            moduleDir = value;
        }
        get {
            return moduleDir;
        }
    }

    [STAThread]
    public static void Main(string[] args) {

        Application.EnableVisualStyles();
        Application.DoEvents();

        ModuleDir = Path.GetDirectoryName(Application.ExecutablePath);
        Console.WriteLine(ModuleDir);

        if ( args.Length > 0 ) {
            string ext = Path.GetExtension(args[0]).ToLower();
            Console.WriteLine(ext);
            //   if ( ext == Globals.ProjectExtension )
            //        MyMainForm.LoadProject(args[0]);
            //    else if ( ext == Globals.SolutionExtension )
            //        MyMainForm.LoadSolution(args[0]);
        }

        Application.Run(MyMainForm);

    }
}
pal is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Idea. Wizard1988 Coder's Corner Lounge 7 Aug 18th, 2006 8:44 PM
I am very novice and have no idea where to start mjmawby Community Introductions 25 Mar 15th, 2006 10:57 AM
Copyright an idea Navid Other Web Development Languages 20 Aug 31st, 2005 3:41 PM
8085 project idea ??? gemini_shooter Assembly 5 Jun 17th, 2005 11:49 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:41 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC