hi all,
I've created a GUI where I display a DataGridView bound to a table. I load all the desired values into the Table and successfully display it in my DGV.
The data is the computers from AD with their location.
Now, I'm trying to display some values depending on a criteria. For example, I'd like to show only the comps located in New York. I've added a comboBox with the different values for Location.
can someone please give me an example of code on how to display only the values I wish?
thanks!
edit: this line of code:
$datagridview1.DataSource.defaultview.rowfilter = "Site -eq '$(($combobox1.SelectedItem).ToString())'"
gives me this error that I still don't understand.
ERROR: Exception setting "rowfilter": "Syntax error: Missing operand after ''NY'' operator."
I feel like I'm getting close though.
edit2: got it!
$datagridview1.DataSource.defaultview.rowfilter = "Site like '$($combobox1.SelectedItem)'"
datagridview & table
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 & table
You have to use the "RowFilter" property of the DataView.
See: https://docs.microsoft.com/en-us/dotnet ... -rowfilter
See: https://docs.microsoft.com/en-us/dotnet ... -rowfilter