qq_46149582 2020-07-02 21:53 采纳率: 100%
浏览 481

请问怎么给datagridview设置列标题?

代码:

class Generic_Course 
{
public Generic_Course() { }
public Generic_Course(int courseId, string courseName, int classHour, string teacher)
{
this.CourseId = courseId;
this.CourseName = courseName;
this.ClassHour = classHour;
this.Teacher = teacher;
}
public int CourseId { get; set; }
public string CourseName { get; set; }
public int ClassHour { get; set; }
public string Teacher { get; set; }
}
Generic_Course course1 = new Generic_Course() { CourseId = 10002, CourseName = "数据库开发", ClassHour = 5, Teacher = "常老师" };
 Generic_Course course2 = new Generic_Course(10005, "高级进阶", 33, "王老师") { };
    List<Generic_Course> courseList = new List<Generic_Course>() { course1, course2, };
    dataGridView1.DataSource = courseList;

图片说明

列标题为英文的,怎么设置为中文的呢?

  • 写回答

2条回答 默认 最新

  • 开局一个bug 2020-07-03 08:18
    关注

    DataGridView dgv = this.dataGridView1;

    dgv.Columns[0].HeaderText = "列1";

    dgv.Columns[1].HeaderText = "列2";

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿