博客
关于我
datagridview 常用操作代码
阅读量:124 次
发布时间:2019-02-27

本文共 880 字,大约阅读时间需要 2 分钟。

得到当前单元格的 headText            this.dataGridView1.Columns[this.dataGridView1.CurrentCell.ColumnIndex].HeaderText得到当前单元格的 Name            string name = this.dataGridView1.Columns[this.dataGridView1.CurrentCell.ColumnIndex].Name;编程方式获得当前行private void getCurrentCellButton_Click(object sender, System.EventArgs e){    string msg = String.Format("Row: {0}, Column: {1}",        dataGridView1.CurrentCell.RowIndex,        dataGridView1.CurrentCell.ColumnIndex);    MessageBox.Show(msg, "Current Cell");}通过编程方式设置当前单元格设置 DataGridView 控件的 CurrentCell 属性。在下面的代码示例中,当前单元格设置为 0 行 1 列。 private void setCurrentCellButton_Click(object sender, System.EventArgs e){    // Set the current cell to the cell in column 1, Row 0.             this.dataGridView2.CurrentCell = this.dataGridView1[1, 0]; //第0行第1列}            this.dataGridView1.Columns[this.dataGridView1.CurrentCell.ColumnIndex].HeaderText

转载地址:http://eerf.baihongyu.com/

你可能感兴趣的文章
mutiplemap 总结
查看>>
MySQL DELETE 表别名问题
查看>>
MySQL Error Handling in Stored Procedures---转载
查看>>
MVC 区域功能
查看>>
MySQL FEDERATED 提示
查看>>
mysql generic安装_MySQL 5.6 Generic Binary安装与配置_MySQL
查看>>
Mysql group by
查看>>
MySQL I 有福啦,窗口函数大大提高了取数的效率!
查看>>
mysql id自动增长 初始值 Mysql重置auto_increment初始值
查看>>
MySQL in 太多过慢的 3 种解决方案
查看>>
MySQL InnoDB 三大文件日志,看完秒懂
查看>>
Mysql InnoDB 数据更新导致锁表
查看>>
Mysql Innodb 锁机制
查看>>
MySQL InnoDB中意向锁的作用及原理探
查看>>
MySQL InnoDB事务隔离级别与锁机制深入解析
查看>>
Mysql InnoDB存储引擎 —— 数据页
查看>>
Mysql InnoDB存储引擎中的checkpoint技术
查看>>
Mysql InnoDB存储引擎中缓冲池Buffer Pool、Redo Log、Bin Log、Undo Log、Channge Buffer
查看>>
MySQL InnoDB引擎的锁机制详解
查看>>
Mysql INNODB引擎行锁的3种算法 Record Lock Next-Key Lock Grap Lock
查看>>