title: How to populate client combobox with items from service's list of objects
body: <p><strong>EDIT</strong>: <a href="http://pastebin.com/EVjD95RY" rel="nofollow">http://pastebin.com/EVjD95RY</a></p>
  
  <p><em>snippet of service's code</em></p>
  
  <p>My Windows Forms WCF client has two combo boxes - combobox1 and combobox2.</p>
  
  <p>My Web Based WCF service has a <code>List</code> of objects with information:</p>
  
  <pre><code>public List&lt;CompanyInfo&gt; companies = new List&lt;CompanyInfo&gt;();
  </code></pre>
  
  <p>Don't know why <code>companies</code> isn't available to me in client. I made the following reference to the service inside client...</p>
  
  <pre><code>Client.ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient();
  </code></pre>
  
  <p>...which should have allowed me to access <code>comapnies</code> like so: <code>client.companies</code></p>
  
  <p>A typical object of CompanyInfo has the following data members:</p>
  
  <p><code>companyName</code>, <code>address</code>, <code>type</code></p>
  
  <p>Inside my client I made it so when I select an item from combobox1, let's say <code>Technology</code>, the combobox2 will become enabled and should populate itself with all of the objects from <code>companies</code> that have their <code>type</code> data member set to 'technology'.</p>
  
  <p>Problem is I can't figure it out. I am trying to use <code>foreach</code> like so:</p>
  
  <pre><code>    private void combobox1_SelectedValueChanged(object sender, EventArgs e)
              {
                  if (combobox1.Text != "")
                  {
                      combobox2.Enabled = true;
  // For every object inside the companies list that have their type set to technology put them into the combobox, disregards the other types
                      if (combobox1.SelectedText.Equals("Technology"))
                      {
  
                          foreach(ServiceReference1.CompanyInfo ci in ?)
                          {
                              if(ci.Type.Equals("technology"))
                                  combobox2.Items.Add(?);
                          }
                      } // more options i.e. combobox1.SelectedText.Equals("Medicine")
                  }
                  else
                      combobox2.Enabled = false;
              }
          }
  </code></pre>