在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)
感谢您的帮助
答案 0 :(得分: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"