c# - Datagridview: how to commit checkbox and and immediately filter by it? -


i have datagridview datagridview1, bound datatable1bindingsource, writable cell being checkbox bound boolean column "isselected". user checks checkbox, want show row checkbox checked. put following code:

private sub datagridview1_currentcelldirtystatechanged(sender object, e eventargs) handles datagridview1.currentcelldirtystatechanged     datagridview1.endedit()     datatable1bindingsource.filter = "isselected" end sub 

but not work - once ckeckbox checked, datagridview not show rows @ all.

if move statement datatable1bindingsource.filter = "isselected" separate command button,

private sub button1_click(sender object, e eventargs) handles button1.click     datatable1bindingsource.filter = "isselected" end sub 

then upon editing checkbox , clicking button, works expected, i.e. shows row.

why not work when it's issued immediately?

found reason. after

sender.endedit 

, before applying filter, have issue

datatable1bindingsource.endedit 

then works expected.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -