[mono-vb] a Console.WriteLine() errors solution

Jude DaShiell jdashiel at shellworld.net
Fri Jul 3 01:03:34 EDT 2009


VisualBasic when a coder puts in a Console.WriteLine() statement that's 
too long throws errors.  What's worse code that worked at one time if its 
indents increase can then break.  The VisualBasic system isn't 
sophisticated enough to do word wrapping within Console.WriteLine() 
statements or a single Console.WriteLine() statement and include enough of 
them in their code so these errors go away.  The good news though and 
please nobody tell Microsoft or they'll screw this up royally too is that 
Console.WriteLine() works differently when writing out the value of a 
variable.  If a variable's value is over 80 characters in length, when 
Console.WriteLine() gets used on it, Microsoft does the line wrapping for 
you automatically.  You can test this with a screen of text to be written 
with a Console.WriteLine() statement and the use of two variables and a 
short subroutine. What follows is code that's in the public domain since 
it was paid for with taxpayer's dollars if you live in the United States 
Of America.
Cut here.
Option Strict Off
Imports System

Module Module1
Rem start entering program control code on line 12.
Rem copied from shell.vb.
Rem put Public Variables and Constants after this line and above subroutines and functions.
Public ScreenVar As String

Sub Main()
Rem put program's main control code below this line and above End Sub main line.
Rem File: bigwrite.vb - easy way to use Console.WriteLine().
Rem by: Jude DaShiell and David Oliver.
Rem Date: July 2, 2009.
Rem Version: 1.1.
Rem Code Status: placed in public domain.
Rem use Csub to load ScreenVar with enough text to fill screen.
Csub("Line 01: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 02: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 03: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 04: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 05: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 22: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Csub("Line 23: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
Rem clear console then write screenful of text with one Console.WriteLine() statement.
Console.Clear()
Console.WriteLine(ScreenVar)
End Sub ' main()
Rem put any more subroutines and functions below this line and above End Module1 line.

Sub Csub(LineVar As String)
ScreenVar = ScreenVar & LineVar
End Sub ' Csub()
End Module ' Module1
Cut here.



More information about the Mono-vb mailing list