Check for Windows Version

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

Talk2Tom11
03-11-2004, 11:13 PM
I have realized that the problem is with this line:

Dim fL as New Load

Load is the name of the form that is to be opened if the operationg system is correct... but it opens it anyway even if it is not correct... Please post if you have any Idea what I can do

Phierce
03-11-2004, 11:44 PM
Here is a helpfull link on this..

Obtaining Windows' Version Information
http://vbnet.mvps.org/code/system/getversionex.htm

Talk2Tom11
03-13-2004, 11:53 PM
thank you for the link... I have fixed my problem already though... but the link is helping me with other stuff. thanx again

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum