I know that this problem is mostly aesthetic, but it annoys me. I hate answering my question, but in fact I came up with a pretty decent solution for this, based on some input from others. I will attach a sample code if someone wants to do something like this in the future. I know that there are probably better ways to do this, but here is what I did.
Basically, instead of using console.writeline from each thread, I created a new routine (TextOut) that has some logic. I also updated my input stream to read each char into a common line instead of using console.readline (). Here is the code:
Private command As String = "" Private Sub ConsoleInput() Dim cki As ConsoleKeyInfo cki = Console.ReadKey() If cki.Key = ConsoleKey.Escape Then command = "" 'Clear command ElseIf cki.Key = ConsoleKey.Backspace Then If Len(command) > 0 Then 'Make sure you don't go out of bounds For i As Integer = 0 To Len(command) Console.Write(" ") 'Clear output since new string will be shorter Next command = Left(command, Len(command) - 1) 'Shorten command by 1 char End If Console.CursorLeft = 0 'Set the cursor to the beginning of the line Console.Write(command) 'Write the command to the screen ElseIf cki.Key = ConsoleKey.Enter Then 'Command has been submitted, start checking Console.CursorLeft = 0 'Set the cursor to the beginning of the line For i As Integer = 0 To Len(command) Console.Write(" ") 'Clear output from command (hides the executed command) Next Dim tempCMD As String = command command = "" 'If/then statements for validating command goes here command = "" 'Clear command to allow new input Else command += cki.KeyChar 'Add char to command string Console.CursorLeft = 0 'Set the cursor to the beginning of the line Console.Write(command) 'Write the command to the screen End If ConsoleInput() 'Loop for more input End Sub Sub TextOut(ByVal message As String) If command <> "" Then For i As Integer = 0 To Len(command) Console.Write(" ") 'Clears output in case output is shorter than current command Next Console.CursorLeft = 0 'Sets cursor to beginning of row End If Console.WriteLine(message) 'Writes the current message to the screen If message <> command Then Console.Write(command) 'Writes the command back to the screen End If End Sub
source share