Version Check

You will need to do the following steps to use this code:

  1. Click on View at the menu bar.
  2. Click on Editor from the View’s options.
  3. Select Register.

These 3 steps will open your deployment project register editor panel, now working with the register panel:

  1. Expand the HKEY_LOCAL_MACHINE
  2. Expand the Software node, you should see your project/application name in the next node.
  3. Select your application name node by clicking on it

Then add an entry here, as follow:

  1. Right click on your application name node, the one you selected on step 6
  2. Move the mouse pointer to New, a sub-menu appears.
  3. Select StringValue
  4. Assign a name to this new entry, Version will do.
  5. Then click the Value option at its properties panel on the right.
  6. Type in the deployment project property (variable) name that hold its version number; which I mentioned above; [ProductVersion]. You should enter it between brackets and remember, it is case sensitive. It will appear like this “[ProductVersion]”, between double quotes.

That’s it, the next time you build and install the project, a register key will be added at: HKEY_LOCAL_MACHINE\SOFTWARE<your_application_name>\Version; it contains your deployment project version number


Dim regVersion As Microsoft.Win32.RegistryKey 
        Dim strVersion As String 

        regVersion = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\<our firm name, highly confidential :-) >", False) 

        Select Case System.Windows.Forms.SystemInformation.ComputerName 
            Case "Whatever1" 
                If Not regVersion Is Nothing Then 
                    Me.Text = "Debug Mode (Version: " & regVersion.GetValue("Version") & ")" 
                Else 
                    Me.Text = "Debug Mode" 
                End If 

                Me.txtInputFileName.Text = "INPUT_DEBUG.TXT" 
            Case "Whatever2" 
                If Not regVersion Is Nothing Then 
                    Me.Text = "RELEASE Mode (Version: " & regVersion.GetValue("Version") & ")" 
                Else 
                    Me.Text = "RELEASE Mode" 
                End If 

                Me.txtInputFileName.Text = "INPUT.TXT" 
            Case Else 
                Throw New Exception("Whatever") 
        End Select