Selected item in a DataGridView

This code will allow you to get the selected item in a DataGridView. In Powershell Studio, make sure to set the ColumnType as DataGridViewCheckBoxColumn


for($i=0;$i -lt $DataGridView1.RowCount;$i++){

if($DataGridView1.Rows[$i].Cells['Checked'].Value -eq $true){
write-host "Row $i is checked"
}
}

datagridview

Leave a Reply