I built a console application with a loop at the end,
While(key <> "q")
'some code
'code to modify the variable [key]
Console.Write("A")
End While
in the loop when the user press “q” on the keyboard, the program will go out of the loop,
I’ve tried using Console.Read or Console.ReadKey
which is not working because it waits for the user to press the keyboard,
but I need the loop to keep running although the user is not pressing the keyboard
so in the program the console will be like:
AAAAAAAAAAAAAAAA,etc. until the user press “q” on the keyboard,
any idea?
You want to use the Console.KeyAvailable property to check if ReadKey will block. Like this: