visual studio - Code to search/filter data in a data grid view in VS C# not working as expected -


this tutorial i'm using: https://www.youtube.com/watch?v=v6nnrixn6dy

and here relevant code:

private void textbox1_textchanged(object sender, eventargs e) {     dataview dv = new dataview(senior_playersdatatable);     dv.rowfilter = string.format("first_name '%{0}%'", textbox1.text);     senior_playersdatagridview.datasource = dv; } 

my datatable called "senior_playersdatatable"

my datagridview called "senior_playersdatagridview"

the column called "first_name"

the gist of tutorial declare relevant datatable globally, create dataview , filter text entered textbox, set data source new, filtered, gridview.

the problem typing text box hides data , rows. them emptying text box not bring them back. ideas i'm going wrong?

additionally, if wanted search more 1 column @ time single text box, simple repeating dv.rowfilter line so?

{     dataview dv = new dataview(senior_playersdatatable);     dv.rowfilter = string.format("first_name '%{0}%'", textbox1.text);     dv.rowfilter = string.format("column2 '%{0}%'", textbox1.text);     dv.rowfilter = string.format("column3 '%{0}%'", textbox1.text);      senior_playersdatagridview.datasource = dv; } 

thank help.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -