Help Wanted

C Sharp – leet hacker

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
ok, so i've started c# programming. i am using the wikibooks book, c# programming, and (of course) the first program is "hello world". it won't work when i try to run it. here is the code:

using System;
namespace MyConsoleApplication
{
class MyFirstClass
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello,");
Console.WriteLine("World!");
Console.ReadLine();
}
}
}

can someone tell me what is wrong with that? i copied it exactly from the book, and i even tried copy-and-pasting it, but it still wouldn't work.

------------------
This post Copyright © 2007 leet hacker. All rights reserved. No part of this post may be reproduced or transmitted in any form or by any means, electronic or mechanical, including quoting, without the express written consent of the author.
ISPN: 1-234567-890-1
Archive of Posts Catalog Card Number: 1234567890
10 9 8 7 6 5 4 3 2 1
You have express written consent to quote this post.

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
What exactly does not work? Does it crash? Not run? Does the console window start?

Are you compiling from the IDE or from the command-line? If you are compiling from within the IDE, then look for the Solution Explorer window in the IDE and right-click on your project. Select 'Properties'. A new window opens. Click on the 'Application' tab on the left. Check your output type and be sure it is set to Console Application. You may have it set to Windows Application.

Skynes
Member

Posts: 202
From: Belfast, N Ireland
Registered: 01-18-2004
I'm using the Visual C# 2005 Edition.

I used the exact code you gave (cut n paste)

I went to File --> New Project. I chose a Blank Project.

I added a new class called MyFirstClass

copied your code in. Built it and ran it.


It worked.

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
quote:
Originally posted by skynes:
I'm using the Visual C# 2005 Edition.
I went to File --> New Project. I chose a Blank Project.

i tried that, but i can't find the code window.

------------------
This post Copyright © 2007 leet hacker. All rights reserved. No part of this post may be reproduced or transmitted in any form or by any means, electronic or mechanical, including quoting, without the express written consent of the author.
ISPN: 1-234567-890-1
Archive of Posts Catalog Card Number: 1234567890
10 9 8 7 6 5 4 3 2 1
You have express written consent to quote this post.

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
So it does compile?

To get the code window, go to the solution explorer and open the file you want or add a new class under Project->Add Class.

again, did the same as sknes and it worked just fine.

Did you try what S2 suggested? Sounds like he really nailed your problem on the head.

------------------
Q.E.D.

leet hacker

Member

Posts: 118
From: Hobbiton, Shire, Middle-Earth
Registered: 07-30-2007
now it's working. i wonder what was wrong? thanks arch and skynes and s^2!

------------------
This post Copyright © 2007 leet hacker. All rights reserved. No part of this post may be reproduced or transmitted in any form or by any means, electronic or mechanical, including quoting, without the express written consent of the author.
ISPN: 1-234567-890-1
Archive of Posts Catalog Card Number: 1234567890
10 9 8 7 6 5 4 3 2 1
You have express written consent to quote this post.