'环境'没有申报?

时间:2015-11-04 23:37:29

标签: vb.net sharpdevelop

我在Windows 8.1 Update 1计算机和Visual Basic Windows窗体上使用SharpDevelop 4.4.2,我试图检索操作系统的名称/信息但是当我使用这段代码:

Private Sub button1Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
    Dim major As Integer = Enviroment.OSVersion.Version.major
    Dim minor As Integer = Enviroment.OSVersion.Version.minor
    If major = 5 And minor = 2 Then
        Me.Label2.Text = "Operating System: Windows XP"
    ElseIf major = 6 And minor = 0 Then
        Me.Label2.Text = "Operating System: Windows Vista"
    ElseIf major = 6 And minor = 1 Then
        Me.label2.Text = "Operating System: Windows 7"
    End If
End Sub

它在输出中给出了这个错误:

Dim major As Integer = Enviroment.OSVersion.Version.major
Dim major As Integer = Enviroment.OSVersion.Version.minor

任何想法为什么?

0 个答案:

没有答案