欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#中TextBox實(shí)現(xiàn)輸入提示功能的方法

 更新時(shí)間:2015年06月20日 12:10:44   作者:zhuzhao  
這篇文章主要介紹了C#中TextBox實(shí)現(xiàn)輸入提示功能的方法,涉及C#中TextBox的相關(guā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ì)有所幫助。

相關(guān)文章

最新評(píng)論