comboBox 的模糊查询和自动填充

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;\\suggest模糊查询,Append自动填充
            comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
            comboBox1.Items.Add("ccdflad");
            comboBox1.Items.Add("adffd");
            comboBox1.Items.Add("afffcflad");
            comboBox1.Items.Add("aflad");
            comboBox1.Items.Add("adelad");
            comboBox1.Items.Add("aadcd");
            comboBox1.Items.Add("adead");
        }
    }
}

你可能感兴趣的:(技术文章)