I have a datagridview which filters on a boolean field where it's false. If the user clicks on the field, the line disappears immediately I guess because it no longer satisfies the filter. Is there any way to prevent this?
So you're saying that the datagridview is not updating immediately after you set the filter property of the binding source? If that is the case, try to call bindingsource.ResetBindings(false) after you set the filter to force the DGV to update.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it. - Abraham Lincoln -
No. When complete is clicked on the dgv and then something else is clicked, the line disappears. I'd like to prevent that.
Yes that can happen. The attached VS2008 project replicates your issue using xml loaded into a DataTable which becomes the data source of a BindingSource connected to a DataGridView.
Work the filter using the button and combobox with the checkbox checked and unchecked. Watch the label under the checkbox for different behaviors i.e. row disappears or the filter auto flips to match the new value of the DataGridView Checkbox column.
In the end if you are filtered on one thing and change the value of a column which does not match the filter then you need to decide if the filter should be completely removed or in this case a Boolean toggle the filter.
Note ignore the other columns other than the first column in the DataGridView.
One option would be to call SuspendBinding on the BindingSource, but that's probably not a good idea. Another option might be change the way you set the Filter. Call the Select method of the DataTable to get all the rows that match your criteria. Create a String containing all their IDs. Create a filter expression that gets records where the ID is IN that list. Now, the records with those IDs will be displayed no matter what changes you make to them. Note that any new rows added will be filtered out though.
Currently when the checkbox is checked, the row does not disappear. It disappears when another row is checked. Then that row disappears when another row is checked. Is there any way to make it so it disappears immediately (as a workaround)?
Currently when the checkbox is checked, the row does not disappear. It disappears when another row is checked. Then that row disappears when another row is checked. Is there any way to make it so it disappears immediately (as a workaround)?
If you'd read the documentation for the DataGridViewCheckBoxColumn then you'd know why that happens and how to do what you're asking for. I've said it before and I'll say it again: always read the documentation first.
I'm not getting a project when I open Checkandlink in VB 2008 Express. Is this the solution file?
Do not know what the problem is as I do not have Express. I created the project at home on VS2008 and then opened it at work from downloading it here in VS2010 no problem.