Why doesn't this (READLINE) code ask for user input?

rgouette

New member
Joined
Jun 28, 2023
Messages
4
Location
Maine, USA
Programming Experience
3-5
I have a very simple 4.8 .NET framework Windows desktop app(C#), the 1st thing after FormLoad, is :

string myUserName = Console.ReadLine();

In debug, it hits it, but flies right by it.. no prompting..

What am I doing wrong?
 
Because a WinForms program doesn't have a console to read from. You should make your project a console program, or add extra code to attach a console to a GUI program. I recommend the former.
 
wow, funny.. I swear I read somewhere where another person encountered this, and the answer was "You need to create a desktop application"..
jokes on me!

Thanks mate,
~R
 
WinForms, WPF, and Console appss are all desktop apps.
 

Latest posts

Back
Top Bottom