C#中winform中dataGridView显示自定义列
代码如下我只想显示姓名一列请问之后怎么写???List<student>stu=newList<student>();stu.Add(newstudent{Name="小...
代码如下 我只想显示姓名一列 请问之后怎么写???
List<student> stu = new List<student>();
stu.Add(new student { Name = "小黑", Age = 22, Score = 100 });
stu.Add(new student { Name = "小红", Age = 22, Score = 90 });
stu.Add(new student { Name = "小明", Age = 22, Score = 88 });
dataGridView1.AutoGenerateColumns = false;//不让其自动生成列!!!
dataGridView1.DataSource = stu; 展开
List<student> stu = new List<student>();
stu.Add(new student { Name = "小黑", Age = 22, Score = 100 });
stu.Add(new student { Name = "小红", Age = 22, Score = 90 });
stu.Add(new student { Name = "小明", Age = 22, Score = 88 });
dataGridView1.AutoGenerateColumns = false;//不让其自动生成列!!!
dataGridView1.DataSource = stu; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询