lundi 9 décembre 2019

Powershell: Check all checkboxes in a row where column header is unknown

I am having trouble creating a "SelectAll" checkbox column that actually selects all checkboxes in a ROW not a column. The "SelectALL" column is the third column in the table that i would like to check all the boxes after it in the same ROW. The column names that follow the "SelectALL" column are dynamically generated so the column names are unknown prior to table generation. Here is my code so far:

$CheckAll_click = {
for($i=0;$i -lt $DGV1.RowCount;$i++){
    if($DGV1.Rows[$i].Cells['SelectAll'].Value -eq $true) {
        for($j=3;$j -le $DGV1.ColumnCount;$j++){
            ($DGV1.Rows[$i].Cells | ?{$_.ColumnIndex -eq $j}).Value=$true
        }
    }
    else {
        for($j=3;$j -le $DGV1.ColumnCount;$j++){
            ($DGV1.Rows[$i].Cells | ?{$_.ColumnIndex -eq $j}).Value=$false
        }
    }
}



Aucun commentaire:

Enregistrer un commentaire