title: Powershell Testing the values in a combobox
body: <p>I am trying to test if a combobox contains values and if it doesn't then execute some code. The combobox should always contain two values which are version numbers in the form 7.xx.xxx.xxx
  Here is what I have so far....</p>
  
  <pre><code>function GetAvailableVersions{
      if ((Get-Variable UpdateNewVersionCombo).value.Items.ToString() -notlike 7){
          $ProdVersionNumber = (Get-ChildItem '\\172.20.10.18\home$\BuildCopier V7 Prod\Optima.exe').VersionInfo.FileVersion
          $GetProd = ($ProdVersionNumber.ToString())
          (Get-Variable UpdateNewVersionCombo).Value.Items.Add($GetProd)
          $DevVersionNumber = (Get-ChildItem '\\172.20.10.18\home$\BuildCopier V7 Dev\Optima.exe').VersionInfo.FileVersion
          $GetDev = ($DevVersionNumber.ToString())
          (Get-Variable UpdateNewVersionCombo).Value.Items.Add($GetDev)
      }   
  
  }
  </code></pre>
  
  <p>The function GetAvailableVersion is called when the selected index of another combobox is changed. When it is called for the first time it adds the version numbers to the combobox as expected, but when the index of the first combobox is changed the test on the current values fails and the version numbers are added to the combobox again, resulting in the versions being duplicated.
  Please can someone shed some light on how to test the combobox for already containing values that start with 7.</p>