Visual Basic 2012 Voorbeelden
   

visual basic 2012 broncode voorbeelden

Blijf op de hoogte van de recente aanpassingen op vbvoorbeelden!

Microsoft Visual Studio 2012Microsoft Developers Network - Visual BasicMicrosoft .NET Framework

27.3. Omgevings Variabelen - System.Environment

Print Email Deel op Twitter Deel op Facebook

Dit artikel is gepubliceerd op maandag 15 oktober 2012 op vbvoorbeelden, bezoek de website voor een recente versie van dit artikel of andere artikels.

27.3.1. System.Environment

De System.Environment klasse bevat allerlei shared methods om omgevings informatie op te vragen.

Enkele members worden hieronder geïllustreerd :
Visual Basic 2012 Broncode - Codevoorbeeld 688
Class Example
    Public Shared Sub Main()
        ' information operating system :
        Dim myOS As System.OperatingSystem = Environment.OSVersion
        Console.WriteLine("OS + version : " & myOS.ToString())
        Console.WriteLine("OS-version   : " & myOS.Version.ToString())
        Dim myOSPlatform As System.PlatformID = myOS.Platform
        Console.WriteLine("platform     : " & myOSPlatform.ToString())
        '
        ' newline used in this environment :
        Console.Write(Environment.NewLine())
        '
        ' common language runtime information :
        Dim myRunTime As System.Version = Environment.Version
        Console.WriteLine("runtime       : " & myRunTime.ToString())
        Console.WriteLine("major version : " & myRunTime.Major.ToString())
        '
        Console.Write(Environment.NewLine())
        '
        ' process information :
        Console.WriteLine("physical memory : " & _
                                             Environment.WorkingSet.ToString())
        '
        Console.Write(Environment.NewLine())
        '
        ' computer information :
        Console.WriteLine("NetBIOS name : " & Environment.MachineName)
        Console.WriteLine("processors   : " & _
                                         Environment.ProcessorCount.ToString())
        '
        Console.Write(Environment.NewLine())
        '
        ' directories :
        Console.WriteLine("system-directory : " & Environment.SystemDirectory)
        Console.WriteLine("active-directory : " & Environment.CurrentDirectory)
        Console.WriteLine("program files    : " & _
             Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles))
        Console.WriteLine("my documents     : " & _
              Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
        '
        Console.Write(Environment.NewLine())
        '
        ' logical drives :
        Dim logicalDrives As String() = Environment.GetLogicalDrives()
        For Each logicalDrive As String In logicalDrives
            Console.WriteLine(logicalDrive)
        Next
        '
        Console.Write(Environment.NewLine())
        '
        ' login information :
        Console.WriteLine("username       : " & Environment.UserName)
        Console.WriteLine("userdomainname : " & Environment.UserDomainName)
        '
        Console.ReadLine()
    End Sub
End Class
Console Application Output
OS + version : Microsoft Windows NT 6.0.6000.0
OS-version   : 6.0.6000.0
platform     : Win32NT

runtime       : 2.0.50727.1433
major version : 2

physical memory : 20082688

NetBIOS name : HOME
processors   : 4

system-directory : C:\Windows\system32
active-directory : D:\Visual Basic\bin\Debug
program files    : C:\Program Files
my documents     : C:\Users\myUserName\Documents

C:\
D:\
E:\
F:\

username       : myUserName
userdomainname : myUserDomain

Dit artikel is gepubliceerd op maandag 15 oktober 2012 op vbvoorbeelden, bezoek de website voor een recente versie van dit artikel of andere artikels.