Wrox Programmer Forums
|
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2009, 07:43 AM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Method must have a return type

on Page-44 just when I'm going to run the program, I dont know what cause it.

Code:
   public static Main()
    {
        frmMain main = new frmMain();
        Application.Run(main);
    }
error in word Main()..

Please help..
 
Old November 25th, 2009, 01:14 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default 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)
The Following User Says Thank You to DrPurdum For This Useful Post:
Mr.Rendezvous (November 25th, 2009)
 
Old November 25th, 2009, 05:21 PM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Well it works now, now I can continue to the next page.
Thank you sir :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
return type as Form neriam Beginning VB 6 1 August 9th, 2009 02:25 AM
Return Collection object from a Web Method raybo .NET Web Services 2 June 17th, 2006 07:42 AM
return type? Sibananda Tripathy J2EE 1 January 3rd, 2005 04:03 AM
Return OleDb.OleDbConnection from the WEB method? Dmitriy Pro VB 6 2 May 4th, 2004 07:10 AM
Return DataTable from Web Method Function kasie ASP.NET 1.0 and 1.1 Basics 2 February 11th, 2004 06:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.