| Console: WriteValue |
Writes a string to the Console output stream without a NewLine break.
Public Sub WriteValue( ByRef Value As Variant, ParamArray args ( ) As Variant )
Values are converted to their string representation for text output. A formatted output can be created similar to cString.Format.
Private Sub Main() Dim i As Long ' Writes out a sequence of digits. The digits '' are written on the same line. Console.WriteValue "Loop 1: " For i = 1 To 5 Console.WriteValue i Next i '' Writes out a new line manually. Console.WriteValue vbCrLf '' Writes formatted values on the same line. Console.WriteValue "Loop 2: " For i = 1 To 5 Console.WriteValue "i = {0}" & IIf(i < 5, ", ", ""), i Next i '' The outputs from the loops are'' Loop 1: 12345'' Loop 2: i = 1, i = 2, i = 3, i = 4, i = 5End SubAs shown, the first loop writes 5 digits to the console, each digitfollowing the previous digit on the same line. WriteValue does notinclude line-breaks. A manual line-break is written to achieve theeffect of advancing to the next line. The second loop uses a formattedvalue output. The argument is substituted in the formatted value andthen written to the output onto the same single line. A comma is addedto distinguish each iteration though the loop.
Project VBCorLib Overview Class Console Overview Console Properties Console Methods WriteLine