I am trying to capture the text I write to put inside a string, but I face several problems.
I will leave my code here, if someone has a better solution and can contribute thank you.
public static void ReadLine(ref string output) { var KeyboardState = Keyboard.GetState(); var inputKeybord = KeyboardState.GetPressedKeys(); if (inputKeybord.Length > 0) { inputEvent = InputEvent.PRESSED; keya = inputKeybord[0]; } if (inputEvent == InputEvent.PRESSED & KeyboardState.IsKeyUp(keya)) { switch (keya) { case Keys.Space: output += " "; break; case Keys.Back: { if (!string.IsNullOrEmpty(output)) { output = output.Remove(output.Length - 1); } break; } } if (keya >= Keys.A & keya <= Keys.Z) { if (KeyboardState.CapsLock) output += keya.ToString().ToUpper(); else output += keya.ToString().ToLower(); } keya = 0; inputEvent = InputEvent.CLICKED; } }