Click here to Skip to main content
15,887,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Original title: "Dynamic search and display options in the search drop down list in the table that the search was conducted at the same time"

Hi
I have a combobox in the table.
I want to change the text inside the combobox inside the Grid ,columns in several tables to do my search and found items to display
For example, such code
private void Grid1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
    if (Grid1.CurrentCell.ColumnIndex==2)
    {
        e.Control.TextChanged += Grid1_TextChanged;
    }

}

private void Grid1_TextChanged(object sender, EventArgs e)
{
    var list = from p in db.Drugs
               where p.VirtualCode.Contains(Grid1.CurrentRow.Cells["dName"].Value.ToString())
               join
               q in db.GenericDrugs
               on p.GenericID equals q.GenericID
               select q;
    dName.DataSource = list;
    dName.DisplayMember = "Genericname";

}


My first problem is that
At the same time these items in the dropdown list does not display
What should I do to open the dropdown list at the same time the display?
Posted
Updated 10-Jan-11 7:36am
v2

A bit hard to understand what you actually want here, but it kind of sounds like filtering, so here is a nice article on the subject:
DataGridView Filter Popup[^]

It's just a guess, hope it helps you out :)

Regards
Espen Harlinn
 
Share this answer
 
v3
You did not populate your combo box, at least not in the code you show.
You need to add items explicitly or assign a data source.
 
Share this answer
 
v2
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900