winforms - Update datagrid view with updated data -


i've datagridview. read xml file , bind data gridview. change xml , save in form. reread xml file , bind gridview. datatable getting updated values. grid not getting updated till close , open application again. how it?

thank you.

regards, raghavendra

#1

is there databind() or rebind() datagridview? set datasource -

dvmovieslist.datasource = dtmovies; 

if add new row dtmovies table , set datasource again, getting reflected. if edit values of of existing rows , re assign datasource not getting reflected till close , open application again. ideas?

thank you.

i think need place bindingsource in between datagridview , datatable.

datagridview _dgv = new datagridview(); bindingsource _bs = new bindingsource(); datatable _dt = new datatable(); . . . _dgv.datasource = _bs; _bs.datasource = _dt; 

now whenever _dt gets updated, bindingsource should take care of refreshing datagridview , shouldn't have worry resetting datasource property. datasource properties can set in initializecomponent() method (the designer), form's constructor, or form.load event handler.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -