如何填充组合框. [英] how to fill combobox .

查看:69
本文介绍了如何填充组合框.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在组合框中显示与角色用户类型相关的项目列表.
或者,如果用户输入列表中不存在的任何新项目,则可以添加到数据库中.

我正在c#.net中使用Windows窗体.
请帮助我.
预先感谢.

I want to show list of items related to character user type in combobox.
or if user enter any new item that not present in list can add to database.

I am using Windows forms in c#.net.
pls help me.
Thanks in advance.

推荐答案

hiii,

请遵循以下步骤,

1)设置组合框的属性:
AutoCompleteMode =建议;
AutoCompleteSource = ListItems;

hiii,

follow following steps,

1) Set Properties of combobox:
AutoCompleteMode = Suggest;
AutoCompleteSource = ListItems;

comboBox1.Leave += new System.EventHandler(this.comboBox1_Leave);



并int此事件添加代码以插入数据库/列表中,并且
只是刷新数据源.
即清除组合框的先前列表项,然后从数据库中再次插入



And int this event add code to insert in database/list and
just refresh data source.
i.e clear previous list items of combobox and insert again from database


这篇关于如何填充组合框.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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