Hey All,
I have a tool I've been working on to dynamically populate AD security groups from a specific OU into a CheckedListBox. From here I can quickly manage adding groups to one or more users. This method is working great currently but I would like to add the ability to filter with a textbox to quickly find certain groups when needed. I've searched around and found posts that state this isn't possible with CheckedListBox without retaining the status of boxes that get filtered out.
After more searching, I was able to put together a nice DataGridView as a test although I'm not super familiar with them yet. I can filter the group names and check the boxes next to them but can't figure out how to get the checked group names to output for use in a function. Can anyone possibly point me to a good example or resource? Or suggest a better way to accomplish this?
Thank you!
DataGridView Question
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.
Re: DataGridView Question
hi,
I was able to make this by using a Textbox control and the following code;
that works perfectly for me!
I was able to make this by using a Textbox control and the following code;
Code: Select all
$textboxFilter_TextChanged={
for ($i = 0; $i -lt $datagrid.RowCount; $i++)
{
if ($datagrid.Rows[$i].Cells[0].value -notlike "*$($textboxFilter.text)*")
{ $datagrid.Rows[$i].Visible = $false }
else
{ $datagrid.Rows[$i].Visible = $true }
}
}