dataGridView2.Columns[0].HeaderText = "Drive";
dataGridView2.Columns[0].DataPropertyName = root.ToString();
this.dataGridView2.Rows.Add(dataGridView2.Columns[0].DataPropertyName);
dataGridView2.Columns[1].HeaderText = "Volume Name";
dataGridView2.Columns[1].DataPropertyName = volumename.ToString();
this.dataGridView2.Rows.Add(dataGridView2.Columns[1].DataPropertyName);
dataGridView2.Columns[2].HeaderText = "Size";
dataGridView2.Columns[2].DataPropertyName = size.ToString();
dataGridView2.Rows.Add(dataGridView2.Columns[2].DataPropertyName);
我无法在列 [1] 和 [2] 中添加行,因为它正在添加列 [0] 索引。