Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDisplay all of a program's environment variables
Keywordsenvironment variables
CategoriesSoftware Engineering, Windows
 
The Environ function takes as a parameter either the name of a variable or an index into the collection of variables defined. To list all of the environment variables, pass the function increasing indexes until it returns an empty string.
 
Private Sub Form_Load()
Dim i As Integer
Dim txt As String

    i = 1
    Do
        If Environ(i) = "" Then Exit Do

        txt = txt & Environ(i) & vbCrLf
        i = i + 1
    Loop

    Text1.Text = txt
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated