how i can view new rows in datagridview added to list that is previously assigned as datagridview.datasource?
+2
A:
You need to re-call the databind() method to see any updates to the data.
brendan
2009-02-17 14:17:34
i have this code to data grid view list<businessEntity.group> groupList;DataGridView1.DataSource = groupList;how i will write databind()??!!please......explain ......
2009-02-17 14:29:57
DataGridView1.DataBind(); - simple as that
brendan
2009-02-17 15:06:50
+1
A:
On WinForms:
If the list doesn't automatically notify the DataGridView
of changes, the only way I know to display the new rows is to set the DataSource
to null
and then back to your list again.
You should probably be using a BindingSource
here to both make your life easier and avoid visual hiccups in the UI. Bind the DataGridView
to the BindingSource
and the BindingSource
to your list. Then you can just call BindingSource.ResetBindings(false)
to update it with your new rows.
lc
2009-02-17 14:27:25