title: Using Linq to filter a ComboBox.DataSource?
body: <p>in another topic, I've stumbled over this very elegant solution by Darin Dimitrov to filter the DataSource of one ComboBox with the selection of another ComboBox:
  <a href="https://stackoverflow.com/questions/2257899/how-to-filter-combobox-in-combobox-using-c/2487706#2487706">how to filter combobox in combobox using c#</a></p>
  
  <pre><code>combo2.DataSource = ((IEnumerable&lt;string&gt;)c.DataSource)
  .Where(x =&gt; x == (string)combo1.SelectedValue);
  </code></pre>
  
  <p>I would like to do a similar thing, but intead of filtering by a second combobox, I would like to filter by the text of a TextBox. (Basically, instead of choosing from a second ComboBox, the user simply enters his filter in to a TextBox). However, it turned out to be not as straight forward as I had hoped it would be. I tried stuff as the following, but failed miserably:</p>
  
  <pre><code>     cbWohndresse.DataSource = ((IEnumerable&lt;DataSet&gt;)ds)
              .Where(x =&gt; x.Tables["Adresse"].Select("AdrLabel LIKE '%TEST%'"));
          cbWohndresse.DisplayMember = "Adresse.AdrLabel";
          cbWohndresse.ValueMember = "Adresse.adress_id";
  </code></pre>
  
  <p><em>ds</em> is the <em>DataSet</em> which I would like to use as filtered DataSource.
  <em>"Adresse"</em> is one <em>DataTable</em> in this DataSet. It contains a <em>DataColumn "AdrLabel"</em>. Now I would like to display only those "AdrLabel", which contain the string from the user input. (Currently, %TEST% replaces the textbox.text.)</p>
  
  <p>The above code fails because the lambda expression does not return Bool. But I am sure, there are also other problems (which type should I use for IEnumerable? Now it's DataSet, but Darin used String. But how could I convert a DataSet to a string?</p>
  
  <p>Yes, I am as much newbyish as it gets, my experience is "void", and publicly so. So please forgive me my rather stupid questions.</p>
  
  <p>Your help is greatly appreciated, because I can't solve this on my own (tried hard already).</p>
  
  <p>Thank you very much!</p>
  
  <p>Pesche</p>
  
  <p>P.S. I am only using Linq to achieve an uncomplicated filter for the ComboBox (avoiding a View). The rest is not based on Linq, but on oldstyle Ado.NET (ds is filled by an SqlDataAdapter), if that's of any importance.</p>