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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:09:18+00:00 2026-06-03T22:09:18+00:00

I have a datagridview and am populating its datasource property through the following interface:

  • 0

I have a datagridview and am populating its datasource property through the following interface:

mainGrid.DataSource = IFace.fillMainGridView();

The mainGrid has a column called CustID. It is easy to search for CustID if I populate mainGrid using databinding as follows:

customerBindingSource.Filter = "CustID like '%" + SearchtextBox.Text + "%'";

I’m trying this code to search the CustID. I am trying to search for CustID using the following code, but it is not working

for(int rowIndex = 0; rowIndex<mainGrid.Rows.Count; rowIndex++)
for (int columnIndex = 0; columnIndex < mainGrid.ColumnCount; columnIndex++)
{
    if (mainGrid[columnIndex, rowIndex].Value.ToString() == SearchtextBox.Text)
        return rowIndex;
}

Please advise.

  • 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-03T22:09:19+00:00Added an answer on June 3, 2026 at 10:09 pm

    I think this will work

         foreach (DataRow row in mainGrid.Rows)
            {
                if (row["ColumnName"].ToString() == SearchtextBox.Text )
                {
                return CustID;
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView whose datasource is a BindingList. MyObj has a few nullable
The DataGridView has a property DataSource that can simply be assigned to a DataTable
I have a dataGridView that has a column with checkboxes. Whenever the user clicks
At present i have a the following code populating a datagridview showing the user
i have datagridview which has one combobox column. i populate combobox column. when i
I have a winform which has a gridview that is populating through a stored
I have DataGridView and I set DataSource of datagridview by using DataTables. DataTable dt
I have datagridview with checkbox column, but I want, that some of the columns
I have a DataGridView, which is not set to ReadOnly. None of its columns
I have a DataGridView that is bound to a list of objects called BaseChange.

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.