C#中TextBox實(shí)現(xiàn)輸入提示功能的方法
本文實(shí)例講述了C#中TextBox實(shí)現(xiàn)輸入提示功能的方法。分享給大家供大家參考。具體如下:
設(shè)置TextBox的AutoCompleteSource的屬性為CustomSource,設(shè)置TextBox的AutoCompleteMode屬性為SuggestAppend。
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using WindowsApplication7.DataSet1TableAdapters; namespace WindowsApplication7 { public partial class Form1 : Form { DataSet1 ds = new DataSet1(); CustomersTableAdapter adpter = new CustomersTableAdapter(); public Form1() { InitializeComponent(); } private void BuildAutoCompleteList() { AutoCompleteStringCollection filterVals = new AutoCompleteStringCollection(); foreach (DataRow dr in ds.Customers) { filterVals.Add(dr["CompanyName"].ToString()); } txtCompanyName.AutoCompleteCustomSource = filterVals; } private void Form1_Load(object sender, EventArgs e) { adpter.Fill(ds.Customers); BuildAutoCompleteList(); } } }
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
- c# 設(shè)置TeeChart控件的提示文本
- C#瀏覽器提示跨域問(wèn)題解決方案
- C#實(shí)現(xiàn)倒計(jì)時(shí)關(guān)閉提示框功能
- C#實(shí)現(xiàn)狀態(tài)欄提示信息功能的示例
- C# winForm實(shí)現(xiàn)的氣泡提示窗口功能示例
- 解決C#調(diào)用dll提示
- C#實(shí)現(xiàn)簡(jiǎn)單的loading提示控件實(shí)例代碼
- c#消息提示框messagebox的詳解及使用
- C#程序提示“正由另一進(jìn)程使用,因此該進(jìn)程無(wú)法訪問(wèn)該文件”的解決辦法
- C#提示:“在證書存儲(chǔ)區(qū)中找不到清單簽名證書”的解決方法
- c# 關(guān)閉窗體時(shí)提示的小例子
- 給 c# 程序員的十個(gè)重要提示
相關(guān)文章
VS中模仿WPF模板創(chuàng)建最簡(jiǎn)單的WPF程序
這篇文章主要為大家詳細(xì)介紹了VS中模仿WPF模板創(chuàng)建最簡(jiǎn)單的WPF程序的相關(guān)資料,感興趣的小伙伴們可以參考一下2016-05-05C#數(shù)值轉(zhuǎn)換-顯式數(shù)值轉(zhuǎn)換表(參考)
就是在將一種類型轉(zhuǎn)換成另外一種類型時(shí),需要額外的代碼來(lái)完成這種轉(zhuǎn)換。2013-04-04C#面向?qū)ο笤O(shè)計(jì)原則之里氏替換原則
這篇文章介紹了C#面向?qū)ο笤O(shè)計(jì)原則之里氏替換原則,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-03-03C# 實(shí)現(xiàn)WebSocket服務(wù)端教程
這篇文章主要介紹了C# 實(shí)現(xiàn)WebSocket服務(wù)端教程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-10-10