亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時間:2015年06月20日 12:10:44   作者:zhuzhao  
這篇文章主要介紹了C#中TextBox實現(xiàn)輸入提示功能的方法,涉及C#中TextBox的相關操作技巧,需要的朋友可以參考下

本文實例講述了C#中TextBox實現(xiàn)輸入提示功能的方法。分享給大家供大家參考。具體如下:

設置TextBox的AutoCompleteSource的屬性為CustomSource,設置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();
   }
 }
}

希望本文所述對大家的C#程序設計有所幫助。

相關文章

最新評論