Freek's Blog

SQL en .NET vraagstukken en oplossingen die ik zoal tegenkom
posts - 199, comments - 123, trackbacks - 2, articles - 7

My Links

News

Google analytics script: Locations of visitors to this page

Article Categories

Archives

Post Categories

Image Galleries

Algemene links

MSDN

vb links

Wednesday, May 12, 2010

//collect directory names and put them in an array
string
[] mapnaam = System.IO.Directory.GetDirectories(@"C:\");

//loop through the array
foreach
(string map in mapnaam)
{
//for each file found in the directory with the extension 'txt'
foreach
(string filename in System.IO.Directory.GetFiles(map, "*.txt", System.IO.SearchOption.TopDirectoryOnly))
{
do something...
}
}

posted @ 12:32 PM | Feedback (0)

Example:

Console.BackgroundColor = ConsoleColor.Blue;

Console.ForegroundColor = ConsoleColor.White;

Other colors are:(the colors are not exact, only an indication of it)

             Black
             DarkBlue
             DarkGreen
             DarkCyan
             DarkRed
             DarkMagenta
             DarkYellow
             Gray
             DarkGray
             Blue
             Green
             Cyan
             Red
             Magenta
             Yellow
             White

 

posted @ 12:27 PM | Feedback (0)