DataGridView : How to index first row

by tim91700 at 2012-12-09 10:15:53

Hello,

On a dataGridView, I have the first line for names of columns.

How I can fix this one, and sort the rest of the grid ?

My code :
$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)


Thanks for your help
by DonJ at 2012-12-09 10:30:14
I’m gonna have to bail on this one. I’m not a NET GUI guy… But if you ask at StackOverflow.com I know you’ll get an answer. And if you can share it here, that’d be cool!! And apologies for not knowing.
by tim91700 at 2012-12-10 00:58:13
Hello,

I asked my question on StackOverflow.com and I had this :
$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"


I try, and it’s good