问题
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