Help with Console.ReadLine()

I can't get the application to read the data on the same line.

Page 1 of 1

2 Replies - 2025 Views - Last Post: 06 October 2009 - 04:16 PM Rate Topic: -----

#1 yubtub   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-October 09

Help with Console.ReadLine()

Posted 06 October 2009 - 04:12 PM

Console.WriteLine("Enter first chickens eggs:");
egg1AsString = Console.ReadLine();

I am a new user to this website, and new to C#.
I understand how to do most simple stuff on C#, but I just can't get the Console.ReadLine() to read the entry on the same line of the entry.

i.e.

Enter the number of eggs from the first chicken: 2

as opposed to

Enter the number of eggs from the first chicken:
2

I'm searching through my book but all their example programs have it being entered in the next line.

Please help me
-Andy

Is This A Good Question/Topic? 0
  • +

Replies To: Help with Console.ReadLine()

#2 mparril   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-August 09

Re: Help with Console.ReadLine()

Posted 06 October 2009 - 04:16 PM

Use Console.Write instead of WriteLine
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6258
  • View blog
  • Posts: 24,026
  • Joined: 23-August 08

Re: Help with Console.ReadLine()

Posted 06 October 2009 - 04:16 PM

Use Console.Write() instead of Console.WriteLine(). WriteLine adds a return/newline/linefeed whatever you want to call it.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1