Search code examples
c#datagridviewbindingsource

Why is BindingSource.Filter hiding null values in DataGridView?


Hello I have ran into an odd issue and can't figure out what is going on. I have a DataGridView control that is binded to a BindingSource on my form and three CheckBox controls that filter values based off if the value in a column is Null, NOT Null. The third CheckBox is causing me problems. I try to hide values if the value in the column is equal to 'RETEST PASSED', but it will also cause Null values to be hidden as well. Here is the line of code where I set the filter:

_bSource.Filter = "repair_action <> 'RETEST PASSED'";

Does anyone know why the Filter would hide rows with Null values as well as the rows with the value 'RETEST PASSED'? In my head the logic seems sound. I interpret it as "If the value in repair_action doesn't equal 'RETEST PASSED' then display row". Is this not what's going on?

Thank you in advance.


Solution

  • How about

     _bSource.Filter = "repair_action Is Null Or repair_action <> 'RETEST PASSED'";
    

    HTH