Sunday, April 22, 2018

c# - Redirect console input and output to a textbox

Hi there and thanking in advance



I am trying (very hard) to redirect Console input and output into a textbox. So far output is working fine but the trouble is with input.
For example I cannot execute a simple program that will do the following:




Console.WriteLine("Please enter your name: ");
string name = Console.ReadLine();
Console.WriteLine("Hi there " + name);



The reason I can't achieve this is because that the program has to stop while waiting for user to type his/her name and press enter. If I wait for user input on a new thread then the main GUI thread freezes and the textbox can never receive the KeyPress. This thing has me totally stumped. Any advice (or better still code) would be greatly appreciated.



Cheers

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...