![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
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: |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jul 2006
Location: using Earth.Africa.Egypt.Cairo;
Posts: 76
Rep Power: 3
![]() |
>>>Application.Run(MyMainForm);
try entering new before MyMainForm: Application.Run(new MyMainForm()); |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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.
|
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() ![]() |
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." |
|
|
|
|
|
#8 |
|
Expert Programmer
|
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.
|
|
|
|
|
|
#9 | |
|
Professional Programmer
|
Quote:
![]() 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 4:02 PM. Reason: To see if the space was intentional or not |
|
|
|
|
|
|
#10 |
|
Programmer
Join Date: Mar 2005
Location: Washington
Posts: 91
Rep Power: 4
![]() |
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);
}
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New Idea. | Wizard1988 | Coder's Corner Lounge | 7 | Aug 18th, 2006 9:44 PM |
| I am very novice and have no idea where to start | mjmawby | Community Introductions | 25 | Mar 15th, 2006 11:57 AM |
| Copyright an idea | Navid | Other Web Development Languages | 20 | Aug 31st, 2005 4:41 PM |
| 8085 project idea ??? | gemini_shooter | Assembly | 5 | Jun 17th, 2005 12:49 PM |