Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, how do i make my program check to see if a registry key exists before it allows my program to execute, this is because i want the program to check its been installed correctly before it launches

I would create this registry key in the installation, so i need to know how do i make the installer ask for a registration key which allows software to be installed (installer being made by the vb.net installer maker thing

 

jonathan

  • Administrators
Posted

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim rk As Microsoft.Win32.RegistryKey
       rk = Microsoft.Win32.Registry.Users.OpenSubKey("Test")    'your key here

       If rk Is Nothing Then
           'key didn't exist
       End If
   End Sub

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • Administrators
Posted

Not that different from above

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim rk As Microsoft.Win32.RegistryKey
       rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("software/revoshift/webhost toolbox/")

       If Not rk Is Nothing Then
           'key did exist
           If rk.GetValue("valid") = "true" Then
               'value is correct
           End If
       End If
   End Sub

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim rk As Microsoft.Win32.RegistryKey

       rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("software/revoshift/webhost toolbox/")



       If Not rk Is Nothing Then

           MsgBox("Ah")


       End If
       If rk.GetValue("valid") = "true" Then

           MsgBox("Yippe")

       End If

   End Sub

 

isnt doing anything

Posted

yup, it gets up to there and then stops workin

 

i also tried

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim rk As Microsoft.Win32.RegistryKey

       rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("software/revoshift/webhost toolbox/")



       If Not rk Is Nothing Then

           MsgBox("Ah")

           If rk.GetValue("valid") = "true" Then

               MsgBox("Yippe")

           End If

       End If
   End Sub

  • Administrators
Posted

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim rk As Microsoft.Win32.RegistryKey

rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("software\revoshift\webhost toolbox\")

If Not rk Is Nothing Then
   If rk.GetValue("valid") = "true" Then
       MessageBox.Show("Yippe")
   End If
End If
End Sub

I had the slashes the wrong way round in my earlier post :), what you get for not testing....

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...