C#编程-80:DataGridView单元格自动填充_彭世瑜_新浪博客
发布日期:2021-07-01 06:18:03
浏览次数:2
分类:技术文章
本文共 1106 字,大约阅读时间需要 3 分钟。
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace DataGridViewAutoFill
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- // TODO: 这行代码将数据加载到表“companyDataSet.clerk”中。您可以根据需要移动或删除它。
- this.clerkTableAdapter.Fill(this.companyDataSet.clerk);
- }
- private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
- {
- string title = dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].HeaderText;
- if (title.Equals("department"))
- {
- TextBox autoText = e.Control as TextBox;
- if (autoText != null)
- {
- autoText.AutoCompleteMode = AutoCompleteMode.Suggest;
- autoText.AutoCompleteSource = AutoCompleteSource.CustomSource;
- AutoCompleteStringCollection autoCollection = new AutoCompleteStringCollection();
- autoCollection.Add("开发部");
- autoCollection.Add("财务部");
- autoCollection.Add("技术部");
- autoText.AutoCompleteCustomSource = autoCollection;
- }
- }
- }
- }
- }
转载地址:https://pengshiyu.blog.csdn.net/article/details/109661806 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2024年04月29日 23时00分24秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
【接口自动化】
2019-05-01
Python解惑之:True与False
2019-05-01
你要的微信小程序终于来了
2019-05-01
有了这些 Chrome 插件,效率提升10倍(建议收藏)
2019-05-01
只有1%的程序员搞懂过浮点数陷阱
2019-05-01
一名 Google 工程师的大数据处理经验
2019-05-01
命名难,难于上青天
2019-05-01
没钱没公司,怎么做一款付费产品
2019-05-01
代码整洁之道-编写 Pythonic 代码
2019-05-01
树莓派程序开机自启动
2019-05-01
连锁门店无线通信方案
2019-05-01
配置Lotus Domino集群视频详解
2019-05-01
Linux软件万花筒
2019-05-01
全球开源软件发展趋势分析
2019-05-01
Linux常用的安全工具
2019-05-01
python 多进程之进程池的操作
2019-05-01
flask整理之 flask程序中的debug模式
2019-05-01
比特币,父母这一辈能接受吗?
2019-05-01
SnapEx的新感觉,对新手很友好
2019-05-01