数据显示到列表框中 [英] data show into listbox
本文介绍了数据显示到列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文本框,如果我输入字符A,则它应该在列表框中显示与字符A相关的数据列表.
i Have one textbox if i enter character A then it should show list of data related to character A into Listbox.
推荐答案
山姆,您可以使用以下命令代码:
Hi Sam, You can use following code:
int index = listBox1.FindString(this.textBox1.Text);
if(0 < index)
{
listBox1.SelectedIndex = index;
listBox1.TopIndex = listBox1.SelectedIndices[0];
}
关于textBox1_Click事件:
On textBox1_Click event:
textBox1.Select(textBox1.Text.IndexOf(textBox1.text), textBox1.Text.Length);
textBox1.Focus();
希望对您有所帮助.
Hope it will help you.
使用DataBindingDource.Filter:
use DataBindingDource.Filter:
public void textBox1_TextChanged(object sender, EventArgs e)
{
string filter = string.Format("Column_Name Like '%{0}%'", textBox1.Text.Replcae("'", "''").Replace("[", "[[]");
// Column_Name iscolumn name of a table that you have bounded to the listBox
BindingSource.Filter = filter;
}
请参阅以下链接
对于Web应用程序
在jQuery Tabs内容中自动完成文本框 [ ^ ]
http://4rapiddev.com/javascript/asp-net-jquery-autocomplete-textbox/ [ ^ ]
http://www.aspsnippets.com/Articles/Using-jQuery- AutoComplete-Plugin-in-ASP.Net.aspx [ ^ ]
http://tpeczek.blogspot.in/2010/05/jquery-autocomplete- in-aspnet-mvc.html [ ^ ]
^ ]
http://stackoverflow.com/questions/305994/jquery-autocomplete-and-asp-net [ ^ ]
对于Windows应用程序
http://programmerspot7.blogspot.in/2012/01/autocomplete-textbox-in- windows.html [ ^ ]
http://www.devproconnections.com/article/database-development/simplify- data-entry-with-autocomplete [ ^ ]
http://www.c-sharpcorner.com/UploadFile/mahesh/AutoCompletion02012006113508AM/AutoCompletion.aspx [ ^ ]
http://www.c -sharpcorner.com/uploadfile/aa04e6/autocomplete-combobox-in-datagridview-using-C-Sharp-net-windows-application/ [ http://nareshonline4u.blogspot.in/2010/11/autocomplete-textbox-in- cwindows.html [ ^ ]
Please see the following links
For Web application
Auto complete textbox in jQuery Tabs content[^]
http://4rapiddev.com/javascript/asp-net-jquery-autocomplete-textbox/[^]
http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx[^]
http://tpeczek.blogspot.in/2010/05/jquery-autocomplete-in-aspnet-mvc.html[^]
http://weblogs.asp.net/seanmcalinden/archive/2010/06/12/asp-net-mvc-2-auto-complete-textbox-custom-view-model-attribute-amp-editortemplate.aspx[^]
http://stackoverflow.com/questions/305994/jquery-autocomplete-and-asp-net[^]
For Windows application
http://programmerspot7.blogspot.in/2012/01/autocomplete-textbox-in-windows.html[^]
http://www.devproconnections.com/article/database-development/simplify-data-entry-with-autocomplete[^]
http://www.c-sharpcorner.com/UploadFile/mahesh/AutoCompletion02012006113508AM/AutoCompletion.aspx[^]
http://www.c-sharpcorner.com/uploadfile/aa04e6/autocomplete-combobox-in-datagridview-using-C-Sharp-net-windows-application/[^]
http://nareshonline4u.blogspot.in/2010/11/autocomplete-textbox-in-cwindows.html[^]
这篇关于数据显示到列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文