设为首页 加入收藏

TOP

C#DataGridView的简单使用
2019-09-17 18:35:37 】 浏览:21
Tags:C#DataGridView 简单 使用

首先创建一个DataGridView控件,然后创建列(包括列名的定义),

由于我不是和数据库进行连接,只是为了输出好看一点。

删除所有数据:

while (this.dataGridView1.Rows.Count != 0)
            {
                this.dataGridView1.Rows.RemoveAt(0);
            }

添加一行数据:

index = this.dataGridView1.Rows.Add();//获取新的一行

                this.dataGridView1.Rows[index].Cells[0].Value = “第一列”;
                this.dataGridView1.Rows[index].Cells[1].Value = “输出形式为字符串”;
                this.dataGridView1.Rows[index].Cells[2].Value = "第三列";
           

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇asp.net core 3.0 gRPC框架小试 下一篇企业移动应用和Smobiler

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目