Random Console Colors!-VBForums
Results 1 to 2 of 2

Thread: Random Console Colors!

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Chit Chat Forum.

    Random Console Colors!

    The ConsoleColor enum has 16 values.

    C# Code:
    1. var random = new Random();
    2. for(var i; i < 100; i++)
    3. {
    4.      Console.ForegroundColor = (ConsoleColor)random.Next((int)ConsoleColor.Black, (int)ConsoleColor.Yellow);
    5.      Console.BackgroundColor = (ConsoleColor)random.Next((int)ConsoleColor.Black, (int)ConsoleColor.Yellow);
    6.      Console.WriteLine(i);
    7. }
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  2. #2
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Wales UK

    Re: Random Console Colors!

    Cool did not know about the color stuff thanks for shareing.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width