hi all,
I have a GUI where a datagridview shows all installed updates on a computer.
I'm trying to add a filter textbox that will hide all rows where the filter's content will not appear.
so if someone put KB366 in that filter textbox, i wish to display only the KB that start with 366.
how can I accomplish that?
Thanks!
display only specific rows in datagridview
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: display only specific rows in datagridview
got it!
this does what i need
for ($i = 0; $i -lt $dataInstUpdates.RowCount; $i++)
{
if ($dataInstUpdates.Rows[$i].Cells[0].value -notlike "KB$($textboxFilterUpdate.text)*")
{ $dataInstUpdates.Rows[$i].Visible = $false }
else
{ $dataInstUpdates.Rows[$i].Visible = $true }
}
thanks!
this does what i need
for ($i = 0; $i -lt $dataInstUpdates.RowCount; $i++)
{
if ($dataInstUpdates.Rows[$i].Cells[0].value -notlike "KB$($textboxFilterUpdate.text)*")
{ $dataInstUpdates.Rows[$i].Visible = $false }
else
{ $dataInstUpdates.Rows[$i].Visible = $true }
}
thanks!
Re: display only specific rows in datagridview
Might be easier to do :
$datagridview.datasource.defaultview.rowfilter = "<valuename> -notlike 'KB$($textboxFilterUpdate.text)*'"
...assuming the datasource is a datatable.
$datagridview.datasource.defaultview.rowfilter = "<valuename> -notlike 'KB$($textboxFilterUpdate.text)*'"
...assuming the datasource is a datatable.
Re: display only specific rows in datagridview
Again - you are missing the big picture. The RowFilter works on a ListBox too.
If you start with "System.Windows.Forms.Control you will learn how all of these things work. By guessing you will be constantly doing things the hard way.
If you start with "System.Windows.Forms.Control you will learn how all of these things work. By guessing you will be constantly doing things the hard way.
Re: display only specific rows in datagridview
Whilst the Microsoft Docs are a great resource they are lousy at teaching stuff for beginners.
If one could learn everything from the MS docs then one wouldnt need forums like this or stackoverflow etc...
And Sapien shouldnt have to offer classroom training...
If one could learn everything from the MS docs then one wouldnt need forums like this or stackoverflow etc...
And Sapien shouldnt have to offer classroom training...
Re: display only specific rows in datagridview
You need to read the training documents and not just the control documents.
https://docs.microsoft.com/en-us/dotnet ... dows-forms
And you have to actually study and understand what teh teaching material is trying to show you.
https://docs.microsoft.com/en-us/dotnet ... dows-forms
And you have to actually study and understand what teh teaching material is trying to show you.