Talk2Tom11
03-03-2004, 06:37 PM
I am having a little problem... I wrote a code to check if the computer is running windows xp, and if it is, then go through to the program, if not then give a messagebox error. But the problem is, if you are not running it, and wait a few seconds after the messagebox has been displayed, the main form will popup. here is my code
Private Sub Start_Check_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myKey As Microsoft.Win32.RegistryKey
Dim strLocation As String
Dim strKey As String
strLocation = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strKey = "ProductName"
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)
If myKey.GetValue(strKey) = "Microsoft Windows XP" Then
fL.ShowDialog(Me)
Else
MessageBox.Show("You are Running " & myKey.GetValue(strKey) & ". " & _
" You Must Run Windows XP or Higher", _
"Windows Version Check", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
Me.Close()
End If
myKey.Close()
End Sub
End Class
Private Sub Start_Check_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myKey As Microsoft.Win32.RegistryKey
Dim strLocation As String
Dim strKey As String
strLocation = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strKey = "ProductName"
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)
If myKey.GetValue(strKey) = "Microsoft Windows XP" Then
fL.ShowDialog(Me)
Else
MessageBox.Show("You are Running " & myKey.GetValue(strKey) & ". " & _
" You Must Run Windows XP or Higher", _
"Windows Version Check", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
Me.Close()
End If
myKey.Close()
End Sub
End Class