Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 684593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:50:01+00:00 2026-05-14T01:50:01+00:00

in another topic, I’ve stumbled over this very elegant solution by Darin Dimitrov to

  • 0

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:
how to filter combobox in combobox using c#

combo2.DataSource = ((IEnumerable<string>)c.DataSource)
.Where(x => x == (string)combo1.SelectedValue);

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:

     cbWohndresse.DataSource = ((IEnumerable<DataSet>)ds)
            .Where(x => x.Tables["Adresse"].Select("AdrLabel LIKE '%TEST%'"));
        cbWohndresse.DisplayMember = "Adresse.AdrLabel";
        cbWohndresse.ValueMember = "Adresse.adress_id";

ds is the DataSet which I would like to use as filtered DataSource.
“Adresse” is one DataTable in this DataSet. It contains a DataColumn “AdrLabel”. Now I would like to display only those “AdrLabel”, which contain the string from the user input. (Currently, %TEST% replaces the textbox.text.)

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?

Yes, I am as much newbyish as it gets, my experience is “void”, and publicly so. So please forgive me my rather stupid questions.

Your help is greatly appreciated, because I can’t solve this on my own (tried hard already).

Thank you very much!

Pesche

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:50:02+00:00Added an answer on May 14, 2026 at 1:50 am

    LINQ does not seem, to me, like an obvious solution here. Your data is already loaded into a DataSet structure, so you should be able to do something like this:

    var adresse = ds.Tables["Adresse"];
    adresse.DefaultView.RowFilter = "AdrLabel LIKE '%TEST%'";
    
    cbWohndresse.DataSource = adresse;
    cbWohndresse.DisplayMember = "AdrLabel";
    cbWohndresse.ValueMember = "adress_id"
    cbWohndresse.DataBind();
    

    To address the actual problems in your current code:

    1. If ds is of type DataSet, casting it to IEnumerable<DataSet> will fail.
    2. DataTable.Select returns an array of rows, not a boolean.
    3. Ignoring #1 and #2, your Where() call would return zero, one or more DataSet instances which each have a table named “Adresse” with at least one row matching the filter. Hence, you end up binding your presentational control to a set of DataSet instances, which is not what you need.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to pass this paramater topic to another page, p.s. the page is
Apologies for another question on a similar topic, but I'm inexperienced at this level
I recently wrote another post on this same topic in which I was not
I have read through Scott Hanselman's post on this topic. I found another article
So, another EXC_BAD_ACCESS topic on StackOverflow, but as I'm new to Objective-C this is
Sorry to make another topic on this subjcet but I've already read several of
This question is inspired from another topic which poses this question: Find the first
This is similar to another topic I recently posted, but perhaps this might be
I know that there's a very similar topic for this question, however I'm trying
I saw the other topic and I'm having another problem. The process is starting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.