title: How to populate WIX combo box from Custom action
body: <p>I have added a combo box to my UI. </p>
  
  <pre><code>&lt;Control Id ="ExistingPortCombo" Type="ComboBox" X="120" Y="120" Width="200" Height="50" Property="ComboSelectedPort" ComboList="yes" &gt;
  &lt;ComboBox Property="ComboSelectedPort" /&gt;
  &lt;/Control&gt;
  </code></pre>
  
  <p>I want it to populate from a custom action. I trid to do so as bellow.</p>
  
  <p>Here is my function to populate lists</p>
  
  <pre class="lang-cs prettyprint-override"><code>static int index = 0; 
    private static void AddRecordToList(string propertyName,string text,string value,string control)
          {
              try
              {
                  View view = CurrentSession.Database.OpenView("SELECT * FROM " + control);
  
                  view.Execute();
  
                  Record record = CurrentSession.Database.CreateRecord(4);
  
                  record.SetString(1, propertyName);
                  record.SetInteger(2, ++index);
                  record.SetString(3, text);
                  record.SetString(4, value);
  
                  view.Modify(ViewModifyMode.InsertTemporary, record);
                  view.Close();
              }
              catch (Exception ex)
              {
                  global::System.Windows.Forms.MessageBox.Show(ex.Message);
              }
          }
  </code></pre>
  
  <p>And then I call as:</p>
  
  <pre class="lang-cs prettyprint-override"><code>AddRecordToComboBox("ComboSelectedPort", text, value,"ComboBox");
  </code></pre>
  
  <p>This method works for list boxes but but for Combo box gives errors. </p>
  
  <p>Can anyone see what i am doing wrong here?</p>