Console.BackgroundColor Property gets or sets the background color of the console.
Public Module Example
Public Sub Main()
Dim colorNames() As String = ConsoleColor.GetNames(GetType(ConsoleColor))
For Each colorName As String In colorNames
Dim color As ConsoleColor = CType(System.Enum.Parse(GetType(ConsoleColor), _
colorName), ConsoleColor)
If color = ConsoleColor.Black Then Continue For
Console.Write("{0,11}: ", colorName)
Console.BackgroundColor = ConsoleColor.Black
Console.ForegroundColor = color
Console.WriteLine("This is foreground color {0}.", colorName)
Console.ResetColor()
Next
End Sub
End Module
Related examples in the same category