Thursday, January 01, 2004

Retrieving Environmental Variables

Here is a quick way to retrive an environmental variable.

Dim CompName As String
CompName = Environment.GetEnvironmentVariable("COMPUTERNAME")

If you want to get a bit fancier, here is some sample code on retrieving all the environmental variables and placing them in a listview.

Dim compVariables As IDictionary
compVariables = Environment.GetEnvironmentVariables()

Dim
CompVariable As System.Collections.DictionaryEntry

For
Each CompVariable In compVariables
       Dim listitem As New ListViewItem(CompVariable.Key.ToString())
       listitem.SubItems.Add(CompVariable.Value.ToString())
       ListView1.Items.Add(listitem)
Next


10:22:54 PM    
comment [] trackback []

Happy New Year!!

I wanted to take the time to wish everyone a happy and wonderful New year's. Today is the begining of what I hope to be another great year for myself. For those of my readers I hope that you have great fortunes in your new year.
5:28:50 PM    
comment [] trackback []