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 28th, 2009, 04:15 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default Command prompt?

I just finished chapter 3 of your book (which so far is very good) and I have completed exercise 3 (my code is slightly different to the solution you offer) and whenever I build it I do not get any errors but when I run (F5) the program it seems to open up the windows forms display and a command window and I really have no clue why?

This is my code:

Code:
private void btnEOO_Click(object sender, EventArgs e)
    {
        int input1;
        bool flag;
        
        //Step two
        //Input

        flag = int.TryParse(txtEvenOrOdd.Text, out input1);
        if (flag == false)
        {
            MessageBox.Show("Please only enter whole numbers", "Input Error");
            txtEvenOrOdd.Focus();
            return;
        }

        //Step 3
        //Process

        if ((input1 % 2) == 0)
            //Step 4
            //Display
        {
            MessageBox.Show("The number is even", "Even");
        }
        else
        {
            MessageBox.Show("The number is odd", "Odd");
        }


    }

    private void btnClear_Click(object sender, EventArgs e)
    {
        txtEvenOrOdd.Text = "";
    }

    private void btnExit_Click(object sender, EventArgs e)
    {
        Close();
    }
I can't see what about the code would cause this to happen and this only occurs when I run this project not any others. The command window that opens alongside the form is empty but does display the projects file path.

I took a screen shot but I can't put it in this post (could be useful to attach images to posts?) by command window I mean the black rectangle that displays if you enter "cmd" in run for example.

I hope thats clear, do you have any idea why this might be happening?
 
Old November 28th, 2009, 04:54 PM
Registered User
 
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Command prompt?

This happened to me once and it was simply because I forgot to let Windows know that the project was a Windows Application as the Output Type in the project properties screen. I hope this helps.

Bob
 
Old November 28th, 2009, 05:09 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

Brilliant, that has sorted it out thanks for that completley forgot all about that.
 
Old November 29th, 2009, 07:29 AM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default

Thanks, Bob. That's a fairly common mistake and I'm glad you pointed the reader in the right direction.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)





Similar Threads
Thread Thread Starter Forum Replies Last Post
command prompt karthisena BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 27th, 2007 04:11 AM
Command Prompt karthisena General .NET 2 January 25th, 2007 12:29 PM
Command Prompt Compile andyj00 ASP.NET 1.0 and 1.1 Professional 1 June 16th, 2005 10:28 AM
Command Prompt joconnor PHP How-To 1 August 11th, 2004 06:29 AM
compiling from command prompt shakeelw BOOK: Professional C#, 2nd and 3rd Editions 2 July 13th, 2004 07:38 PM





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