Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Use PlatformID class to identify the currently executing operating system

Imports System Class Sample    Public Shared Sub Main()       Dim os As OperatingSystem = Environment.OSVersion       Dim pid As PlatformID = os.Platform       Select Case pid          Case PlatformID.Win32NT, PlatformID.Win32S, _               PlatformID.Win32Windows, PlatformID.WinCE             Console.WriteLine("This is a Windows operating system.")          Case PlatformID.Unix             Console.WriteLine("This is a Unix operating system.")          Case Else             Console.WriteLine("ERROR: This platform identifier is invalid.")       End Select    End Sub 'Main End Class 'Sample