net2.0提供WinForm中TextBox智能提示,和补全的支持
SqlDataAdapter sda = new SqlDataAdapter("SELECT TEST1 FROM TestTable", "Data Source=.;Initial Catalog=SSO;User ID=sa;Password=******"); DataTable dt = new DataTable(); sda.Fill(dt); var source1 = new AutoCompleteStringCollection(); for (int i = 0; i < dt.Rows.Count; i++) { Source1.Add(dt.Rows[i][0].ToString()); } textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBox1.AutoCompleteCustomSource = source1;