• 大小: 57KB
    文件类型: .zip
    金币: 2
    下载: 2 次
    发布日期: 2021-06-18
  • 语言: C#
  • 标签: C#  WINFROM  

资源简介

C#dataGridView中输入框自动提示、自动完成、自动补全功能

资源截图

代码片段和文件信息

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

namespace dataGridView
{
    public partial class FrmMain : Form
    {
        private AutoCompleteStringCollection source;
        public FrmMain()
        {
            InitializeComponent();
        }

        private void dataGridView1_EditingControlShowing(object sender DataGridViewEditingControlShowingEventArgs e)
        {
            DataGridViewTextBoxEditingControl editingControl = e.Control as DataGridViewTextBoxEditingControl;

            editingControl.AutoCompleteCustomSource = source;

            editingControl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

            editingControl.AutoCompleteSource = AutoCompleteSource.CustomSource;
        }

        private void FrmMain_Load(object sender EventArgs e)
        {
            source = new AutoCompleteStringCollection();
            source.AddRange(new string[]
                            {
                        “January“
                        “February“
                        “March“
                        “April“
                        “May“
                        “June“
                        “July“
                        “August“
                        “September“
                        “October“
                        “November“
                        “December“
                            });
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-03 11:37  dataGridView\
     目录           0  2019-03-03 11:37  dataGridView\.vs\
     目录           0  2019-03-03 11:37  dataGridView\.vs\dataGridView\
     目录           0  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\
     文件       39936  2019-03-03 11:46  dataGridView\.vs\dataGridView\v15\.suo
     目录           0  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\Server\
     目录           0  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\Server\sqlite3\
     文件           0  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\Server\sqlite3\db.lock
     文件        4096  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\Server\sqlite3\storage.ide
     文件       32768  2019-03-03 11:37  dataGridView\.vs\dataGridView\v15\Server\sqlite3\storage.ide-shm
     文件      766352  2019-03-03 11:45  dataGridView\.vs\dataGridView\v15\Server\sqlite3\storage.ide-wal
     目录           0  2019-03-03 11:45  dataGridView\dataGridView\
     文件         189  2019-03-03 11:37  dataGridView\dataGridView\App.config
     文件        4727  2019-03-03 11:44  dataGridView\dataGridView\FrmMain.Designer.cs
     文件        1608  2019-03-03 11:44  dataGridView\dataGridView\FrmMain.cs
     文件        7289  2019-03-03 11:44  dataGridView\dataGridView\FrmMain.resx
     文件         526  2019-03-03 11:40  dataGridView\dataGridView\Program.cs
     目录           0  2019-03-03 11:37  dataGridView\dataGridView\Properties\
     文件        1322  2019-03-03 11:37  dataGridView\dataGridView\Properties\AssemblyInfo.cs
     文件        2837  2019-03-03 11:37  dataGridView\dataGridView\Properties\Resources.Designer.cs
     文件        5612  2019-03-03 11:37  dataGridView\dataGridView\Properties\Resources.resx
     文件        1099  2019-03-03 11:37  dataGridView\dataGridView\Properties\Settings.Designer.cs
     文件         249  2019-03-03 11:37  dataGridView\dataGridView\Properties\Settings.settings
     目录           0  2019-03-03 11:45  dataGridView\dataGridView\bin\
     目录           0  2019-03-03 11:44  dataGridView\dataGridView\bin\Debug\
     文件       10240  2019-03-03 11:45  dataGridView\dataGridView\bin\Debug\dataGridView.exe
     文件         189  2019-03-03 11:37  dataGridView\dataGridView\bin\Debug\dataGridView.exe.config
     文件       28160  2019-03-03 11:45  dataGridView\dataGridView\bin\Debug\dataGridView.pdb
     目录           0  2019-03-03 11:46  dataGridView\dataGridView\bin\Release\
     文件        3622  2019-03-03 11:45  dataGridView\dataGridView\dataGridView.csproj
     目录           0  2019-03-03 11:37  dataGridView\dataGridView\obj\
............此处省略14个文件信息

评论

共有 条评论