仅将值添加到DataGridView C#中的一列 [英] Add values just to one column in DataGridView C#

查看:90
本文介绍了仅将值添加到DataGridView C#中的一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含6列的DataGridView;我希望第一列显示一周中的日期。第二列应显示每天的时间表。但我希望它们以垂直顺序显示,而不是以水平方式显示。但我无法弄明白该怎么做。



我喜欢这样:http://i.stack.imgur.com/0AhMj.jpg [ ^ ]



我想这样: http://i.stack.imgur.com/IHpyd.jpg [ ^ ]



提前致谢

I have a DataGridView with 6 columns; I want the first column to display the days of the week. And the second column should display a schedule per day. But I want them to display in vertical order, not in horizontal way. But I can't figure out how to do it.

I have it like this: http://i.stack.imgur.com/0AhMj.jpg[^]

And I want it like this: http://i.stack.imgur.com/IHpyd.jpg[^]

Thanks in advance

推荐答案

我终于解决了我的问题,使用这段代码:



I finally solved my problem, using this code:

dataGridView1[2, 0].Value = "7:00 - 7:50";<br />
           dataGridView1[2, 1].Value = "7:50 - 8:40";<br />
           dataGridView1[2, 2].Value = "8:40 - 9:30";<br />
           dataGridView1[2, 3].Value = "10:00 - 10:50";<br />
           dataGridView1[2, 4].Value = "10:50 - 11:40";<br />
           dataGridView1[2, 5].Value = "11:50 - 12:40";<br />
           dataGridView1[2, 6].Value = "12:40 - 1:30";<br />





它类似于坐标平面,第一个数字引用列数,第二个数字引用我想要修改的单元格。现在我有一个更大的问题,关于同一个项目,我会在一分钟后发布。请帮助我,我试着解决它四个小时。



It is similar to the coordinate plane, the first number references the number of column, and the second number references the cell that I want to modify. Now I have a bigger problem, about the same project, I'll post it in a minute. Please Help me with that one, I'm trying to solve it since four hours.


这篇关于仅将值添加到DataGridView C#中的一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆