C#Comobobox短路没有将键入的值带到前面 [英] C# Comobobox shorting not bringing the typed value to front

查看:112
本文介绍了C#Comobobox短路没有将键入的值带到前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个组合框,一个是产品ID,另一个是产品名称。对于这两个组合框,我分配相同的DataTable作为数据。



我的组合框属性如下



cmbprID .DataSource = prdList;

cmbprID.DisplayMember =" PRD_ID";

cmbprID.ValueMember =" PRD_ID";



cmbprName.DataSource = prdList;

cmbprName.DisplayMember =" PRD_NAME";

cmbprName.ValueMember =" PRD_NAME";



和自动完成模式=无



短缺=假



现在,当我运行程序时,所有数据都正确加载。当我尝试输入时,它会缩短数据,但有时候某些数据不会出现在前面。但是这些数据可以下载。



按照以下步骤我解决了



Shorted = true;



为此,每件事都很好。但问题是,我没有选择与我选择的PID相关的产品名称。原因是组合框对数据进行排序,以便索引值发生变化。



在我的SQL查询中按产品编号ASC排序。



即使这样也行不通。但它的准确性是更好的初始阶段。



请帮助我解决它的问题

I have two combobox one is product Id and another one is product name. For the both combobox I am assigning same DataTable as datasourse.

My combobox proprieties are follows

cmbprID.DataSource = prdList;
cmbprID.DisplayMember = "PRD_ID";
cmbprID.ValueMember = "PRD_ID";

cmbprName.DataSource = prdList;
cmbprName.DisplayMember = "PRD_NAME";
cmbprName.ValueMember = "PRD_NAME";

and AutoComplete mode=None

Shorted=false

And now when I run the program all the data loading properly. When I tried to type it is shorting the data but some times some of the data not bring to front. But that data available in drop down.

Following steps I took to solve

Shorted=true;

For this every thing is working fine. But the problem is, it is not picking product name with respect to PID which I select. The reason is the combobox sorting the data so the index value getting change.

ORDER BY PRODUCT_ID ASC in my SQL query.

Even this also not working. But it accuracy is better initial stage.

Please help me to get of of it

推荐答案

检查这个链接我希望它会帮助你....

AC#auto complete combo box [ ^ ]



你也可以这样做..



Check This Link I hope It will Help You....
A C# auto complete combo box[^]

You Can Also so do like this..

 ComboBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomeSource;


这篇关于C#Comobobox短路没有将键入的值带到前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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