All the advice on this page should be taken into account as none of them are comprehensive.
I would start with reading the rules.
First, I want to add some ideas to a vise advice by Pranit.
I would add, don't rush and don't jump to the solution. Think around related problems some more even if you think there is a solution. Sleep over with a problem.
Likewise, after the problem is written, don't rush to post it. Even if you tried hard to solve the problem yourself but failed, this experience will be a great favor.
In fact, if you ask question and get good answer, you may even fail to understand them properly if you did not try to solve it yourself. Unfortunately, too many inquirers are not prepared to get help!
Most devastating problem here is incorrect formulation of questions. First, please see my comments to this question. This is a joke, but with a good hint.
Let's set aside questions where people request to do their own work, the questions where people don't know what they want — there are too many of them. Let's aside those not using Wikipedia, Google, StackOverflow and CodeProject search before asking a question.
Most important thing is this: don't ask just what exactly you want at the moment. Always explain you
ultimate goals. I rarely answer exact same answer, instead, I'm thinking about real help, which is not the same. Your question could be based on misconception or preoccupation with wrong conception like some methods and techniques leading to wrong direction. Experts can help you to fix the direction, but only if you explain you ultimate goal, not just what you want to achieve immediately.
In particular, never ask "What's the difference between {0} and {1}?". Just don't. What's the difference between apple and Apple?
[EDIT] See also this related post, I think it's kind of interesting:
what is the difference between the class and encapsulation in programming[
^]. [/EDIT]
Now, code. The code sample should be short but comprehensive. This is hard to do, sometimes impossible. That said, you should
develop some special code sample just for posting a question. Ideally, it should compile and run, yet demonstrating a problem. I know, this is often impossible. Just desirable. At least always paste code from a real code and make sure HTML formatting is correct. Most usual mistake is the failure to escape "<>" with HTML entities. It cab be done with the applet "encode" provided on top of text input box by CodeProject.
Error messages should be presented in detail. Exception information should be presented in detail, complete with exception stack and inner exceptions, recursively. Offending lines of code should be commented with compilation error or exception information.
Finally: correct spelling and grammar! No "textspeak", ever. Full capitalization, punctuation and spelling, no abbreviations. English as not a native language is not an excuse. (This is not my native language, too, so I know what I'm talking about.) Everyone can use a Web browser with spell checker, such as Firefox/Seamonkey. Just spell checking can be obtained free of charge these days.
This is a matter of elementary politeness. Sloppy writing is simply rude.
Thank you for this discussion.
Good luck,
—SA