Get OS Version in VB.NET

So our first code post is a simple one – but could be useful. So if you’re developing a Visual Basic application and need to know which version of operating system the user has, you can do it with the following code:

Public Function OSVersion() As String
Return Environment.OSVersion.ToString
End Function

Example of how this could be used:

You could pull back the OS version using the above string. Feed the result into more VB code and use an IF statement to make certain features available depending on which version of Windows the user has.

Code Flavour is a news site with a focus on coding. Our aim is deliver news over a range of categories which will be insightful and beneficial to readers that are interesting in code development.

You may also like...

1 Response

  1. Code Flavour says:

    Test comment

Leave a Reply

Your email address will not be published. Required fields are marked *