specifying Windows Version.Build

扶醉桌前 提交于 2020-01-06 08:37:10

问题


i have a problem with finding the correct form to tell my app to write a diferent thing in a text box according to windows build

code is:

Private Sub Main_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

Dim OSVer As Version = Environment.OSVersion.Version

    'Windows 10
    If OSVer.Build >= 10240 Then
        My.Forms.Main.WinVer.Text = "Detected Windows 10"
    End If

    'Windows 8 / 8.1
    If OSVer.Build <= 10000 And OSVer.Build >= 8000 Then
        My.Forms.Main.WinVer.Text = "Windows 8 / 8.1 are not supported yet"
    End If

    'Windows 7
    If OSVer.Build >= 7600 And OSVer.Build < 8000 Then
        My.Forms.Main.WinVer.Text = "Detected Windows 7"
    End If

    'OLD WINDOWS VERSION
    If OSVer.Build < 7600 Then
        My.Forms.Main.WinVer.Text = "Your Windows is not supported"
    End If
End Sub

i'm on windows 10 (build 10240), after using this code, the app showed me the text of Windows 8/8.1 situation

How to correct this?


回答1:


According to this MSDN article, you have to target your application properly to get the expected results.

After you setup the manifest properly, you can use the OSVersion.Version.Major and OSVersion.Version.Minor properties to check the operating system. The version numbers are specified in the above mentioned article in tabular form.



来源:https://stackoverflow.com/questions/33109938/specifying-windows-version-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!