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

  • Home
  • SEARCH
  • 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 4121678
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:22:57+00:00 2026-05-20T23:22:57+00:00

I know I asked this question already many times, but I did not get

  • 0

I know I asked this question already many times, but I did not get answer which can help me.

Please, need advice I already trying to do this 1 week or more.

I have a user control where my DataGrid is. There is a toolBar with a button that opens a Find form that has one button and one textBox. On this button click, I call method Search() like this :

private void btnFind_Click_1(object sender, EventArgs e)
{
    Inventory i = new Inventory();
    i.Search(txtFind.Text);
}

and this is how the method Search works :

public void Search(string searchWord) 
{
    AcidDBDataContext db = new AcidDBDataContext();
    var q = db.ProcSearch(searchWord);
    dgvInventory.DataSource = q;
}

This method works fine in inventory but when I click btnFind, it doing nothing, I used a debugger and saw that query is executing correctly and gets rows from table.

Problem is on this line : dgvInventory.DataSource = q;

I’m using C# WinForms and SQL Server 2008

  • 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-20T23:22:58+00:00Added an answer on May 20, 2026 at 11:22 pm

    You could use a BindingSource

    BindingSource bs = new BindingSource();
    

    and then in Search(string searchWord)

    //dgvInventory.DataSource = q;
    bs.DataSource = q;
    if (dgvInventory.DataSource == null)
        dgvInventory.DataSource = bs;
    else
        bs.ResetBindings(false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question was asked here many times before but I am still
I know that this question was asked millions of times, but i already spent
I know this question already have been asked. But I could not find any
I know this question might have been asked a few times already, but I
I know this question has asked many times in SO,but i couldn't figure out
I know that this question has been asked multiple times already , but I
First of all, I know this question has already been asked but the answer
I know this question has been asked many times but I'm looking for a
I know this question has been asked many times before, but I haven't found
I know, this question already been asked in many places repeatedly. But I've tried

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.