自动下拉功能
try{
string strConn = "SERVER=(local);DATABASE=HzInforBase;UID=sa;PWD=123456";
string sql = "select a.eatname,a.pym,b.hotelname,b.pym from eat as a,live as b";
SqlConnection myCn = new SqlConnection(strConn);
myCn.Open();
SqlCommand myCmd = new SqlCommand(sql, myCn);
SqlDataReader P_Dr = myCmd.ExecuteReader();
AutoCompleteStringCollection auto = new AutoCompleteStringCollection();
if (HzInforSys.Properties.Settings.Default.CanHistoryKey != null)
auto = HzInforSys.Properties.Settings.Default.CanHistoryKey;
StringBuilder stri = new StringBuilder();
while (P_Dr.Read())
{
auto.Add(P_Dr[0].ToString());
auto.Add(P_Dr[1].ToString());
auto.Add(P_Dr[2].ToString());
auto.Add(P_Dr[3].ToString());
}
HzInforSys.Properties.Settings.Default.CanHistoryKey = auto;
this.txtgjs.AutoCompleteMode = AutoCompleteMode.Suggest;
this.txtgjs.AutoCompleteSource = AutoCompleteSource.CustomSource;
this.txtgjs.AutoCompleteCustomSource = auto;
}
catch (AccessViolationException aa)
{
MessageBox.Show(aa.Source.ToString());
}
目前能实现这样的功能:
输入拼音码或者中文名,会自动下拉名称。
我想要实现这样一种功能:
如果输入拼音码,下拉显示的是对应的中文名。
大家帮忙看看 --------------------编程问答-------------------- 改一下这个属性:this.txtgjs.AutoCompleteSource = AutoCompleteSource.CustomSource;
看看是通过文件或是别的将两者对应起来,研究下那几个枚举值的含义吧. --------------------编程问答-------------------- 大家帮忙看看 --------------------编程问答-------------------- 那你需要先把拼音转化为汉字,然后在下拉吧
http://www.fixdown.com/wz/article/14/15/2006/47778.htm
汉字转化拼音挺多的啊 --------------------编程问答-------------------- 貌似有点困难
补充:.NET技术 , C#