This article describes the method of TextBox implementing the input prompt function in C#. Share it for your reference. The details are as follows:
Set the AutoCompleteSource property of TextBox to CustomSource, and set the AutoCompleteMode property of TextBox to SuggestAppend.
using System; using ; using ; using ; using ; using ; using ; 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 ) { (dr["CompanyName"].ToString()); } = filterVals; } private void Form1_Load(object sender, EventArgs e) { (); BuildAutoCompleteList(); } } }
I hope this article will be helpful to everyone's C# programming.