for (int i = 0; i < DataGridView1.SelectedRows.Count; i++)
   {
//第i行第一列
String ai1= DataGridView1.SelectedRows[i].Cells[0].Value.ToString();
//第i行第二列
String ai2= DataGridView1.SelectedRows[i].Cells[1].Value.ToString();
}
 
当前行
int rowIndex = DataGridView1.CurrentRow.Index;

--------------------- 作者:hejialin666 来源:CSDN 原文:https://blog.csdn.net/hejialin666/article/details/2578695?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!

DataGridView1的更多相关文章

  1. 06 MDB将数据和dataGridView1绑定

    附件:http://files.cnblogs.com/xe2011/dataGridView1_bindingNavigator1_bindingSource1.rar 实现功能 对.MDB文件进行 ...

  2. dataGridView1.DataSource,解决查询结果不从第一行显示,而是不断往表下面扩展问题

    private void 洱海各月出流流量frm_Load(object sender, EventArgs e) { //在查询按钮中用下面这段代码会出现打开数据库出错的现象 MyTable1.Ro ...

  3. 判断修改的中的值,用前面的,否则容易获得空值;this.dataGridView1.Rows[i].Cells[0].EditedFormattedValue; VS bool b = (bool)this.dataGridView1.Rows[i].Cells[0].Value;

    判断修改的中的值,用前面的,否则容易获得空值:this.dataGridView1.Rows[i].Cells[0].EditedFormattedValue;  VS     bool b = (b ...

  4. C# dataGridView1 添加数据 和清空数据

    #region MyRegion DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); DataGridViewTextBo ...

  5. C#判断dataGridView1 点击的是哪一列上的按钮

    private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { ) { DataGr ...

  6. dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Gold;第一次无效

    private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) {}//修改DataGrid ...

  7. dataGridView1_RowEnter事件与dataGridView1.CurrentRow一起使用错误问题

    在使用DataGridView想在选项行发生改变时获得当前行的,于是使用了RowEnter 但是获得数据却不对,总是获得前一个被选中的行,比如第一次选中谭经理,再选中王海霞,数据得到却是谭经理的 从事 ...

  8. C#中将DataTable导出为HTML的方法

    今天我要向大家分享一种将DataTable导出为到HTML格式的方法.有时我们需要HTML格式的输出数据, 以下代码就可以帮助我们达到目的,. 首先,我们要绑定DataTable和 DataGridV ...

  9. 【基于WinForm+Access局域网共享数据库的项目总结】之篇一:WinForm开发总体概述与技术实现

    篇一:WinForm开发总体概述与技术实现 篇二:WinForm开发扇形图统计和Excel数据导出 篇三:Access远程连接数据库和窗体打包部署 [小记]:最近基于WinForm+Access数据库 ...

随机推荐

  1. jquery easyUI中combobox的使用总结

    jquery easyUI中combobox的使用总结 一.如何让jquery-easyui的combobox像select那样不可编辑?为combobox添加editable属性 设置为false ...

  2. jquery easyUI相关

    jquery easyUI相关===================================easyUI表单验证处理//jquery easyUI 表单验证不通过让光标定位在第一个未通过验证的 ...

  3. 计算概论(A)/基础编程练习1(8题)/3:晶晶赴约会

    #include<stdio.h> int main() { int w; scanf("%d", &w); || w==) { printf("%s ...

  4. SNMP学习笔记之SNMPWALK 安装与使用详解

    0x00 简介 snmpwalk是SNMP的一个工具,它使用SNMP的GETNEXT请求查询指定OID(SNMP协议中的对象标识)入口的所有OID树信息,并显示给用户.通过snmpwalk也可以查看支 ...

  5. jdbc连接池c3p0/dbcp强制连接超过设置时间后失效

    通常来说,各种技术实现的优化参数或者选项或者歪门邪道之所以能被想出来,通常是因为开发者或者实现的贡献者曾经遇到过导致此结果的问题,所以才出了对应的策略选项. 在有些情况下,比如存在客户端或者服务端连接 ...

  6. Python3基础 map+lambda 将指定系列元素乘2

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  7. Go第三篇之大话容器

    Go语言数组 数组(Array)是一段固定长度的连续内存区域 在 Go 语言中,数组从声明时就确定,使用时可以修改数组成员,但是数组大小不可变化 Go 语言数组的声明 数组的写法如下: var 数组变 ...

  8. Python数据分析入门之pandas基础总结

    Pandas--"大熊猫"基础 Series Series: pandas的长枪(数据表中的一列或一行,观测向量,一维数组...) Series1 = pd.Series(np.r ...

  9. hdu Naive Operations 线段树

    题目大意 题目链接Naive Operations 题目大意: 区间加1(在a数组中) 区间求ai/bi的和 ai初值全部为0,bi给出,且为n的排列,多组数据(<=5),n,q<=1e5 ...

  10. nginx 安装手记

    Nginx需要依赖下面3个包 1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )  zlib-1.2.8.tar.gz 2. rewrite 模块需要 p ...