The Main() method
Your title suggests you have figured out the problem. The example you have in your post leaves out the word void from the definition of the Main() method. This is a static method that Windows envokes to initiate the program. This method remains active until the application stops executing. However, Windows requires such a method to return a value to the operating system, which is normally used to indicate error conditions to the op system. By defining the method without the keyword void, you are trying to define a static method called by Windows without telling Windows the return type. Windows gets miffed when you try to do this. The keyword void does NOT mean that the method does not return a value...it does. The void keyword simply means that the return value contains no useful data and the op system can ignore it.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
|