[在此处输入图片描述] [1] [1]:https://i.stack.imgur.com/N7AhL.pngDataGridViewButtonCell))$ dataGridView.Columns [0] .width = 50 $ dataGridView.Columns [1] .width = 200#获取项目列表<#Get-WmiObject -Class Win32_Product | foreach {$ dataGridView.Rows.Add($。检查,$。说明,$ .IdentifyingNumber,$ .name和$ .Vendor,$ .Version,$ .Caption,$.InstallLocation)| out-null}#>#刷新函数gridClick(){$ dataGridView.Text ='删除选定的行'$ rowIndex = $ dataGridView.CurrentRow.Index $ columnIndex0 = $ dataGridView.ColumnIndex + 1 $ columnIndex1 = $ dataGridView.ColumnIndex + 2 $ columnIndex2 = $ dataGridView.ColumnIndex + 3 $ columnIndex3 = $ dataGridView.ColumnIndex + 4 $ columnIndex5 = $ dataGridView.ColumnIndex + 5#Write-Host $ rowIndex#Write-Host $ columnIndex0#Write-Host $ dataGridView.Rows [$ rowIndex ] .Cells [0] .value写主机$ dataGridView.Rows [$ rowIndex] .Cells [$ columnIndex0] .value写主机$ dataGridView.Rows [$ rowIndex] .Cells [$ columnIndex1] .value写主机$ dataGridView.Rows [$ rowIndex] .Cells [$ columnIndex5] .value#$ IdentifyNumber = $ dataGridView.Rows [$ rowIndex] .Cells [$ ClassKey] .value#$ Name = $ dataGridView.Rows [$ rowIndex] .Cells [ $ columnIndex0] .value#$ classKey ='
您可以尝试更改值,例如在网格单击功能中:
$dataGridView.Rows[$rowIndex].Cells[0].Value = "test value"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句