25 Replies
Console.WriteLine();
creates a blank lineThat's not the problem, the proble is I need to get user input line above.
While also displaying the bottom line.
how is that a problem?
Because I have no idea how to do that
Show me your current code
There is nothing there.
or do you mean printing that line before the readline?
Exactly
Write out all the text and then set the cursor position
yeah
write hi
set cursor position
write "you msut enter name"
set cursor position
write "enter your name: "
take input
uh... how do I do that?
The specific layout you posted
No need for any cursor shenanigans
Just good ol'
Console.Write()
nah, they want the "you must enter name" to be printed WHEN its asking for input
Yep
Ah
Then, yeah, cursor shenanigans
thats how you move the cursor around
Alright
the values are just random numbers, not the ones you need
Thanks!
it can be easier to store the position you wantthe cursor to be rather than having to manually supply it yourself:
in the above code, it prints all the stuff up until the user input in needed, then it grabs the current cursor position, then prints the rest of the output, then sets the cursor back to the position we captured
This way you don't have to manually progam 123 Left, and 123 Top... etc
---
however, in general this is not an ideal way to handle input.
Console.ReadLine allows long input and wraps text around
also, if the user changes the size of the window, they can change the current view
changing hte view can cause the text to wrap and thus change cursor positions
---
I can suggest some alternatives, but depending on what you are making, spending a lot of time just to have text after a ReadLine might not be worth it
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.