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
 
 
 
 
 
 
TitleGet the operating system version in VB .NET
DescriptionThis example shows how to get the operating system version in VB .NET. It uses the System.Environment.OSVersion object's properties and methods.
KeywordsOS, OS version, operating system, operating system version
CategoriesVB.NET, Windows
 
Examine System.Environment.OSVersion object's Platform property to see whether the system is a form of Win32 or WinNT. Examine Version.Minor, Version.Major, and Version.Revision.ToString() to see which flavor.
 
' Set the OS version information.
Public Function GetVersion() As String
    Dim os_version As OperatingSystem = OSVersion
    With os_version
        Select Case .Platform
            Case .Platform.Win32Windows
                ' Win32.
                Select Case (.Version.Minor)
                    Case 0
                        Return "Windows 95"
                    Case 10
                        If .Version.Revision.ToString() = _
                            "2222A" Then
                            Return "Windows 98 Second " & _
                                "Edition"
                        Else
                            Return "Windows 98"
                        End If
                    Case 90
                        Return "Windows Me"
                End Select
            Case .Platform.Win32NT
                ' WinNT.
                Select Case (.Version.Major)
                    Case 3
                        Return "Windows NT 3.51"
                    Case 4
                        Return "Windows NT 4.0"
                    Case 5
                        Select Case (.Version.Minor)
                            Case 0
                                Return "Windows 2000"
                            Case 1
                                Return "Windows XP"
                            Case 2
                                Return "Windows Server 2003"
                        End Select
                    Case Else
                        Return "Unknown"
                End Select
            Case Else
                Return "Unknown"
        End Select
    End With
End Function
 
See Knowledge Base article 304289 How To Determine Windows Version with VB.NET.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated