Questions tagged [console.readkey]
52 questions
0
votes
3 answers
Cancelling Console.ReadKey() using code, not in-program
So let's use this code:
Console.ReadKey(true);
//Cancel the ReadKey prompt
Console.WriteLine("ReadKey was cancelled.");
Upon running the program, the only thing that should happen is that the output ReadKey was cancelled. should appear. How can I…

Adam
- 612
- 4
- 13
- 23
0
votes
1 answer
get current key cursors position text
So this is vary basic but I cannot seem to find a function that can do this.
lets say I have the following text starting at 0,0 of the console window
123456789
_
lets say I set the cursor position to 0,3 which is "4" then I use…

Jordan Trainor
- 2,410
- 5
- 21
- 23
0
votes
1 answer
C# Console.ReadKey 1 character lag?
I'm attempting to work with the Console.ReadKey() function in order to intercept the user's keystrokes and rebuild what they are typing on the screen (as I'll need to clear the screen often, move the cursor often, and this seemed like the most…

C Smith
- 778
- 2
- 14
- 31
-1
votes
1 answer
C# Override Console.Read() for a Windows Forms app
i have following problem:
I am making a Windows Forms application and have to use other .cs Files which contain Console.Read() or Console.ReadLine(). The files should not be changed.
I would like now to override the functions in order to use a…

Flomax
- 1
-2
votes
1 answer
How to detect a pressed key?
I have an assignment for college where I have to take strings as an input and stop the program if the user presses CTRL + z and then display the longest and shortest string. I got the Z alright but I can't seem to detect if the user pressed CTRL…

danytb8
- 1
-2
votes
2 answers
Why can't you put Console.ReadKey() in front of the text displayed to the console, or assign Console.ReadKey() to a variable?
using System;
class MainClass {
public static void Main (string[] args) {
Console.WriteLine("Press any key to continue...");
Console.WriteLine(" key pressed", Console.ReadKey());
}
}
this code works and has no errors but
using…

Curulian
- 111
- 1
-2
votes
3 answers
Stopwatch and ReadKey don't work properly
I'm working on my multi-threading password cracker, only numbers. It must show how much time has passed to find the password. I used Stopwatch to find it, but in functions Stopwatch doesn't work. Here is my code:
using System;
using…

Ahmet Özdemir
- 69
- 7