I am working on a project, and I thought I had it set up properly, but it is throwing a couple of debug errors, and I am not sure what to do to fix them, so I am reaching out for some assistance here.
I am attaching a zip of my project in hopes that someone can assist, but I am sure someone can shed some insight on my errors, as you guys always do!
As for the two entry points error it has to do with you having program.cs and program2.cs. The one you should be using is the one that runs your main form so in this case program2.cs has Application.Run(new FrmAirplane()); and excluding program.cs from your project.
So if I understand the link correctly, I need to use this syntax:
Code:
class Base
{
// in my base class use this
protected virtual string GetMood() {...}
}
class Derived : Base
{
// in child class use this
protected override string GetMood() {...}
}
Is that correct?
Last edited by jo15765; August 5th, 2011 at 07:37 AM.
Yes, for methods to be overridden, they need to be marked as virtual (if they have a base class implementation), or abstract (if they don't, and are required to be implemented in a derived class).
I didn't download your zip, but know that, if there are relatively few errors, it often helps to post them here - their actual text, that is. It'll get easier to debug them yourself with experience, as C# compiler error messages are generally very descriptive and right on spot.
That must be what the issue is then, because I did not do that in my project. I will add those features in, and report back once I get home from work, and have had a chance to add those elements.
And thanks for the info, I will for future reference just post as a .txt file when I am having small issues like these.
Personally I would rather seeing someone include zipped project rather than a txt file. If I want to try to compile and run a text file, I have to take my precious time to create a project, copy the txt file context into it and so on. With a zipped project, I can just unzip it and load the project.
For small code snippets, just put the code in [code][/code] code tags directly.
At any rate, I've opened the project and found that you have an extra main function. In the Solution explorer, just select the "Program2.cs" file, right click and choose "Exclude From Project".
That will get rid of the duplicate main compile issue.
Oh I didn't even know you could do the "Exclude from Project"
That's great to know, because I was wanting to somehow add in about 4 - 5 different "Main" (basically copy all of my files from previous projects, and house into a "Master" project, and still have the current project I am running compile with no errors) but I knew that would throw some big issues, with the Exclude from Project I may still be able to dot hat.
And thanks for the info, I will for future reference just post as a .txt file when I am having small issues like these.
Oh, I meant to post the text of the error message directly - not in a txt file, along side your code snippets (use [CODE][/CODE] tags for those). Sometimes, we don't need to run the code to see what's wrong. But if it's a major issue (by your own criteria - something you're really struggling with), then it's better to attach the project, as there could be some errors and code interactions you're not even aware of.
Oh okay, thanks for the clarification. These were minor issues, but I didn't even think of just pasting in what the debug issues were.
Just to be pedantic, I want to clarify the semantics.
What you have is compile errors, which technically aren't debug issues.
Compile issues are errors that occur while you are compiling your program.
Debugging occurs after you are able to successfully compile. Debugging is running your program under a debugger so you can step through and inspect variables while the program is running.
Arjay thanks for the definitions of Debugging and Compiling, I honestly thought that any issue preventing your program from running was a debugging issue! Show's my newbieness.
If it doesn't compile, then it's like it doesn't exist - the processor has no clue what all the program code you've written means. As far as the CPU is concerned, it's just text files. It needs translation, and the compiler does that.
Now, after it compiles and runs, a faulty program can crash, or worse, it can appear to work, when in fact it doesn't do what it is supposed to. A program can be complex, and it's various parts can interact in unpredicted ways. That's where the debugger comes in - it allows you to see what is it that your program is actually doing, what lines throw exceptions, what are the values of variables and parameters, how and why they change, and ultimately, it allows you to figure out how to rewrite the code so that it does what it's supposed to do.
Alrite, so I fixed all compile and debug errors, but now I have a few other ?'s.
For those of you who have looked at the project.....
Since uploading I added a combo box on the form with 3 choices to choose from and I want whichever option the user chose to display in the textbox on the rightside of the form (The message will displayhere box)
What code and Where in my existing code do additions need to be made in order to make this happen?
How do I correct this?
Last edited by jo15765; August 7th, 2011 at 04:37 PM.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.