You might have more luck by using a
BindingSource
Component.
Here[
^] is a link to a page in MSDN with loads of good stuff about the
BindingSource
.
Basically you create a new
BindingSource
(lets call it
myBindingSource
just for this example).
Then in whatever method you do your basic setup for the form (
FormLoad
or the
constructor
) you put
DataGridView1.DataSource = myBindingSource
Then in your
PopulateSharedFilesDatagrid()
method replace
DataGridView1.DataSource = dt
DataGridView1.Refresh()
with
myBindingSource.DataSource = dt
myBindingSource.ResetBindings(False)
There are lots of advantages to using a
BindingSource
.
It makes sorting and filtering much, much easier. Same with error handling and propertychanged handling.
Good luck! :)