2.DataGridView 几个基本操作
2015-08-02 13:00
225 查看
DataGridView的几个基本操作:
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
{
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;
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
{
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;
相关文章推荐
- 1.数据操作类 SqlDBhelper
- 18.Android 程序退出,关闭所有的a…
- 17.GridView宫格的实现及其显示其…
- 16.GridView宫格的实现及其显示其…
- 2.JASP_DOM解析xml基本思路总结
- 1.jsp+servlet+mysql建站基本思路…
- 30.正则表达式(1)
- 4.xml 解析
- 3.利用jasp进行dom方式解析
- 2.xml入门
- 1.xml入门
- 3.JavaScript 基础知识学习
- 2.JavaScript简单了解
- 1.JS实现获取IP信息,包括归属地,…
- 15.对话框和浮动Activity
- 14.Android端请求服务器端的数据Ht…
- 13.Android提交数据到服务器HttpCl…
- Android--获取当前系统时间
- 29.IO学习——总结(1)
- Android SQLite学习指南