ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DataGridView控件学习笔记

DataGridView控件学习笔记

原创 Linux操作系统 作者:bailuotuo 时间:2008-03-04 08:30:07 0 删除 编辑
最近开始研究DataGridView控件,每天学习的记录下来。

第一:遍历datagridiew控件
                //获取datagridview控件的总行数
            int rowNumber = dataGridView1.Rows.Count;
            //获取datagridview控件的总列数
            int colNumber = dataGridView1.Columns.Count;
            string temp = "";
           //控件的最后一行是空的,没有内容,要注意rowNumber-1
            for (int row = 0; row < rowNumber-1; row++)
            {
                for (int col = 0; col < colNumber; col++)
                {
                   temp += dataGridView1.Rows[row].Cells[col].Value.ToString();
                }
            }

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7642859/viewspace-199247/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-29

  • 博文量
    45
  • 访问量
    102598