组合框中的动态搜索和显示选项 [英] Dynamic search and display options in combo boxes

查看:62
本文介绍了组合框中的动态搜索和显示选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原始标题:同时进行搜索的表中搜索下拉列表中的动态搜索和显示选项"


我的桌子上有一个组合框.
我想更改Grid内组合框内的文本,在多个表中的列进行搜索并找到要显示的项目
例如,这样的代码

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?

推荐答案

您没有填充组合框,至少没有在显示的代码中填充.
您需要显式添加项或分配数据源.
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.


在这里很难理解您真正想要的是什么,但这听起来像是过滤,所以这里有一篇不错的文章主题:
DataGridView过滤器弹出窗口 [
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


谢谢
我需要的东西

http://barnamenevis.org/asset.php?fid=64995&uid=32894& d = 1295601825 [ ^ ]

http://barnamenevis.org/asset.php?fid=64996&uid=32894& d = 1295601827 [ ^ ]

请帮助我
Thank you
The thing I need

http://barnamenevis.org/asset.php?fid=64995&uid=32894&d=1295601825[^]

http://barnamenevis.org/asset.php?fid=64996&uid=32894&d=1295601827[^]

please help me


这篇关于组合框中的动态搜索和显示选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆