Skip to content

Instantly share code, notes, and snippets.

@kirb
Created September 9, 2011 07:13
Show Gist options
  • Save kirb/1205657 to your computer and use it in GitHub Desktop.
Save kirb/1205657 to your computer and use it in GitHub Desktop.
Easiest way to make a table at the command line in VB
'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