Created
September 9, 2011 07:13
-
-
Save kirb/1205657 to your computer and use it in GitHub Desktop.
Easiest way to make a table at the command line in VB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'First, place this somewhere in your module or class: | |
Sub TablePadding(ByVal TheText As String, ByVal ThePadding As Integer) | |
Dim len As Short = ThePadding - TheText.Length | |
For i = 1 To len | |
Console.Write(" ") | |
Next | |
End Sub | |
'Now you can call it any time you need it. Such as in this code: | |
Sub Main() | |
Dim MyTitle As String = "This is the title" | |
Console.Write(MyTitle) | |
TablePadding(MyTitle, 24) | |
Console.Write("And some more text") | |
MyTitle = "This is another title" | |
Console.Write(MyTitle) | |
TablePadding(MyTitle, 24) | |
Console.Write("And even more text") | |
End Sub | |
'...it will write this to the console: | |
'This is the title And some more text | |
'This is another title And even more text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment