adding an IF that reads the registry value before a button logic.

I have a VB app that i’ve inherited that my service desks uses.

There’s a button in this app that runs some setup scripts. I have that section of code. What I want to do is copy that section, and add an IF regvalue = WIN 10, do this, ELSE do this other thing. Essentially it’s running a setup script after this based on if it’s win10 or win7. This registry key is in our base image, and is there on the machine.

Recompiled it, and it only ever does the ELSE. It never does the IF, when that key is there. That tells me my IF statement is flawed.

First, is there a way to test this code, to see if it’s giving me a boolean true/false?

Second, Am I even querying the registry correctly?

This is all I added to the app. Inline with the section that did the original provisioning stuff.

 Dim Build As string = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARECOMPANYBuildDetails").GetValue("OperatingSystem") If Build Is "WIN10" Then DO ALL THE STUFF ELSE DO ALL THE STUFF, but different End IF 

submitted by /u/I_forgot_to_hit_save
[link] [comments]

Leave a Reply