如何从访问数据库中使用简单的组合框来搜索数据 [英] How can I use simple combobox for search data from access database
本文介绍了如何从访问数据库中使用简单的组合框来搜索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
How can I use Simple combo box for Search data from access database
please help me...
In details
1)access data(field name is "name" and table name is"customer")
Example data is:
Jayanta
tarak
soumya
suva
dibyendu
amit
arijit
2) vb.net
a-form1
b-simple combo box (connect with access data from combo box properties field----- name)
c- a text box in the form1
I want to when i click on the combo box and type "A" then show Amit and arijit in the combo box list
then I type "Am" then "Amit" full word show in the combo box because no word available with " a and m" only amit
then i want to press enter The searching word "Amit" will be come and show in text box
我尝试了什么:
i am beginner i don'知道什么代码是正确的
What I have tried:
i am beginner i don't know what code is right
推荐答案
连接SelectedValueChanged
或已选中IndexChanged
ComboBox
的事件,并将值传递给SearchDbMethod。
你可以在这里阅读更多内容: ListControl.SelectedValueChanged Event (System.Windows.Forms) [ ^ ]和这里: ComboBox.SelectedIndexChanged事件(System.Windows.Forms) [ ^ ]
以上两个链接都有VB中的示例。
Wire up theSelectedValueChanged
orSelectedIndexChanged
event of theComboBox
and paas the value to the SearchDbMethod.
You can read more here: ListControl.SelectedValueChanged Event (System.Windows.Forms)[^] and here: ComboBox.SelectedIndexChanged Event (System.Windows.Forms)[^]
Both links above have examples in VB.
设置这些属性并使用SelectedIndexChanged
eve nt将组合框中的值设置为文本框。
set these properties and usingSelectedIndexChanged
event to set the value from combobox to the textbox.
comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems
comboBox1.DropDownStyle = ComboBoxStyle.DropDownLis
这篇关于如何从访问数据库中使用简单的组合框来搜索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文