I am trying to write out to console a percentage of data loading. I tried to use C# syntax which would be Console.Write("\rPercentage: " + nCurrent + "/" + nTotal;
however in VB I get the actual character 'r' being displayed in my string. Is there a special code I need to insert in order to update my cursor to the beginning of the line so that I may reuse that line?
Thanks
How to overwrite an existing line without terminal sequence. The \r or carriage return will put the cursor at the beginning of the line and allows you to overwrite the content of the line.
WriteLine(Object) Writes the text representation of the specified object, followed by the current line terminator, to the standard output stream. WriteLine(String, Object, Object, Object, Object)
WriteLine() method displays the output and also provides a new line character it the end of the string, This would set a new line for the next output.
Use vbCr to generate a carriage return character:
Console.Write("{0}Percentage: {1}/{2}", vbCr, nCurrent, nTotal)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With