hi,
I have a DataGridView that has 3 columns, first is a checkbox cell, other 2 are textbox cells.
how can I load the info in it correctly so that the checkbox will not be checked, but will return unchecked if i look at the value?
I do this but when I click on it the first time, it returns False
foreach (...) {
$datagridADGroups.Rows.Add($false, $group.name, $group.info)
}
thanks!
DataGridView & checkbox
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DataGridView & checkbox
Edit the column object and set it to detect the value you want.
See:
Go to full postSee:
Re: DataGridView & checkbox
so I set the values like you showed me (thanks for that by the way) but now when I test it, the code returns $False if I click the checkbox or not. I have no idea why it won't return $False or $True, only $False on both clicks. Like it is not seeing the checkbox is checked.
log-toStatusBox -color Green -text "selection is $($datagridADGroups.CurrentRow.Cells[0].Value)`n"
this is how i check the cell, am I doing it wrong?
thanks.
log-toStatusBox -color Green -text "selection is $($datagridADGroups.CurrentRow.Cells[0].Value)`n"
this is how i check the cell, am I doing it wrong?
thanks.
Re: DataGridView & checkbox
i have no idea why this won't work for me.
my latest try, where nothing is displayed, even though I did check a cell
I'm losing my mind over this, looks simple enough but I can't get it to work.
my latest try, where nothing is displayed, even though I did check a cell
Code: Select all
for ($i = 0; $i -lt $datagridADGroups.Rows.Count; $i++) {
if ($datagridADGroups.rows[$i].Cells[0].Value -eq $true) {
log-toStatusBox -color Green -text "index = $i`n" -skipDate $false
}
}
Re: DataGridView & checkbox
OK I was able to understand part of the issue.
I load the DataGridView with
looping thru it, all the values are $False and they do not chance to $True.
as a test, i tried this
now when I loop, all the values are $True, even the ones i uncheck.
how can I load the data in the datagrid so that it won't be static?
thanks for the help!
I load the DataGridView with
Code: Select all
$datagridADGroups.Rows.Add($false, $group.name, $group.info)
as a test, i tried this
Code: Select all
$datagridADGroups.Rows.Add($true, $group.name, $group.info)
how can I load the data in the datagrid so that it won't be static?
thanks for the help!
Re: DataGridView & checkbox
can you please post an example?
looking at the definition PowerShell Studio shows me, I do not see anything wrong.
looking at the definition PowerShell Studio shows me, I do not see anything wrong.
Re: DataGridView & checkbox
An example of what? You can create rows and set cell values or use an array to assign all cells.
If you right-click any control in the toolbox it will show you links to the documentation and example code.
If you right-click any control in the toolbox it will show you links to the documentation and example code.