仅将值添加到 DataGridView C# 中的一列

Chr*_*oss -1 c# datagridview datagridviewcolumn winforms

我有DataGridView6 列;我希望第一列显示一周中的几天。第二列应显示每天的时间表。但我希望它们以垂直顺序显示,而不是以水平方式显示。但我不知道该怎么做。

我有这样的:在此输入图像描述

我想要这样的:在此输入图像描述

cho*_*aib 5

根据你的第二张图片:

dataGridView1.Rows.Add(9);

// for days column (1st column)
dataGridView1[0,0].Value = "Monday";
dataGridView1[0,3].Value = "Tuesday";
dataGridView1[0,6].Value = "Wednesday";

// for hours column (3rd column)
dataGridView1[2,0].Value = "7:00 - 8:00";
dataGridView1[2,1].Value = "8:00 - 9:00";
dataGridView1[2,3].Value = "7:00 - 7:50";
dataGridView1[2,4].Value = "7:50 - 8:20";
Run Code Online (Sandbox Code Playgroud)

基本上

dataGridView[Column index, Row index].Value是这些坐标处的像元值