DataGridView的几个基本操作
来源:互联网 发布:淘宝产品权重 编辑:程序博客网 时间:2024/05/20 12:50
1、获得某个(指定的)单元格的值:
dataGridView1.Row[i].Cells[j].Value;
2、获得选中的总行数:
dataGridView1.SelectedRows.Count;
3、获得当前选中行的索引:
dataGridView1.CurrentRow.Index;
4、获得当前选中单元格的值:
dataGridView1.CurrentCell.Value;
5、取选中行的数据
string[] str = new string[dataGridView.Rows.Count];
for(int i;i<dataGridView1.Rows.Count;i++)
{
if(dataGridView1.Rows[i].Selected == true)
{
str[i] = dataGridView1.Rows[i].Cells[1].Value.ToString();
}
}
7、获取选中行的某个数据
int a = dataGridView1.SelectedRows.Index;
dataGridView1.Rows[a].Cells["你想要的某一列的索引,想要几就写几"].Value;
dataGridView1.Row[i].Cells[j].Value;
2、获得选中的总行数:
dataGridView1.SelectedRows.Count;
3、获得当前选中行的索引:
dataGridView1.CurrentRow.Index;
4、获得当前选中单元格的值:
dataGridView1.CurrentCell.Value;
5、取选中行的数据
string[] str = new string[dataGridView.Rows.Count];
for(int i;i<dataGridView1.Rows.Count;i++)
{
if(dataGridView1.Rows[i].Selected == true)
{
str[i] = dataGridView1.Rows[i].Cells[1].Value.ToString();
}
}
7、获取选中行的某个数据
int a = dataGridView1.SelectedRows.Index;
dataGridView1.Rows[a].Cells["你想要的某一列的索引,想要几就写几"].Value;
0 0
- DataGridView的几个基本操作
- 2.DataGridView 几个基本操作
- c# DataGridView几个基本属性
- DataSet的几个基本操作
- DataSet的几个基本操作
- DataGridView的几个技巧
- DataGridView的几个技巧
- DataGridView的几个技巧
- DataGridView控件基本操作1
- winform中DataGridView的基本操作以及简单绑定
- 对树的几个基本操作函数
- FreeBSD的几个基本操作配置
- 关于Perl几个基本操作的Demo
- 链表的几个基本操作
- unix 下cshell 的几个基本操作
- 字符串操作函数的几个基本函数
- 链表的几个基本操作
- 关于dataGridView的几个方法
- 智能算法在站点质量评级体系中的应用
- CentOS 6.4下 Apache2.2 + Mysql5.1 +PHP5.3 的配置
- c++拷贝构造函数
- nodejs配置环境
- android之路,布局方式
- DataGridView的几个基本操作
- 【3Dsmax】入门
- Spring AOP注解配置
- Http解析(httppaser.jar)
- eclipse中编辑文本的字体大小设置
- xerces解析和创建xml文件
- Linux内核启动分析(一)
- oracle中varchar2字段转clob字段(读取方法为PHP)
- 真相了!关于“写书”这件事