1

在 dataGridView 上,第一行是列名。

我该如何解决这个问题,并对网格的其余部分进行排序?

我的代码:

$dataGridView1.Width = 500
$dataGridView1.Height = 200
$dataGridView1.DataBindings.DefaultDataSourceUpdateMode = 0
$dataGridView1.Name = "dataGrid1"
$dataGridView1.DataMember = ""
$dataGridView1.Left = 30
$dataGridView1.Top = 55
$dataGridView1.ColumnCount = 4
$row = @( "Machine", "IP" , "OS", "Domain")
$dataGridView1.Rows.Add($row)
$dataGridView1.SelectedRows[0].Index
$dataGridView1.ReadOnly = $true
$dataGridView1.CurrentCell = $dataGridView1.Item(0,1) 

谢谢你的帮助

4

1 回答 1

0

为什么不使用这样的列名?

$dataGridView1.ColumnCount = 4    
#$row = @( "Machine", "IP" , "OS", "Domain")

$dataGridView1.Columns[0].name = "Machine"
$dataGridView1.Columns[1].name = "IP"
$dataGridView1.Columns[2].name = "OS"
$dataGridView1.Columns[3].name = "Domain"
于 2012-12-10T08:27:21.010 回答