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 8932239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:17:32+00:00 2026-06-15T09:17:32+00:00

I have a DataGridView that is filled with objects, now I want a search/filter-function

  • 0

I have a DataGridView that is filled with objects, now I want a search/filter-function for this DataGrid. I’m trying to use a textbox where you can enter a textstring and in my head a want to match this string against all the object fields (for example if the objects are Emails, I want to match the string against the Subject field) in the DataGrid.

If it is to any help the DataGrid.DataSource is declared like this (don’t worry about the methods, the problem is the filter/search-function):

var newMess = LM.GetNewMessages();
if (newMess.Count > 0)
{
    for (int i = 0; i < newMess.Count; i++)
    {
        LM.InboxTemp.Insert(0, newMess[i]);
    }
}
BindingSource source = new BindingSource();
source.DataSource = LM.InboxTemp; //List with Objects
dgNewMess.DataSource = source;
dgNewMess.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
dgNewMess.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
dgNewMess.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
dgNewMess.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
  • 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-06-15T09:17:32+00:00Added an answer on June 15, 2026 at 9:17 am

    If you want to filter collection of Emails, you can use Linq for that. Also you can use ForEach method of List<Email> to insert new filtered emails to your InboxTemp list:

    string filter = txtFilter.Text;
    LM.GetNewMessages()
      .Where(msg => msg.Subject.Contains(filter))
      .ToList()
      .ForEach(msg => LM.InboxTemp.Insert(0, msg));
    

    UPDATE with Equin.ApplicationFramework.BindingListView you can assign datasource this way

    dgNewMess.DataSource = new BindingListView<Email>(LM.InboxTemp);
    

    and later apply filter

    string filter = txtFilter.Text;
    BindingListView<Email> emails = (BindingListView<Email>)dgNewMess.DataSource;
    emails.Filter = new PredicateItemFilter<Email>(msg => msg.Subject.Contains(filter));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView that is bound to a list of objects called BaseChange.
I have a DataGridView that I am trying to bind to a list. I
I have a virtual datagridview that I want to set varying row heights for.
I have this problem: I have a datagridview that reads the data from a
Would someone kindly assist me with the following? I have two DataGridView objects that
I have a DataGridView that is filled by setting its DataSource to a DataBinding.
I have a DataGridView that uses databinding, with manually created columns, and this works
I have a DataGridView that I'm populating from a list. The function that edits
So I have this datagridview that is linked to a Binding source that is
I have a DataGridView that I want users to be able to add records

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.