Question

In my current implementation I'm using a data grid view that is fed from a list of objects. I'm trying to add new entries, by adding new objects to the list.

I'm finding that when these new entries are added to the list, they do not appear in the DataGridView. I've tried updating it, clearing it and refilling it. All to know avail.

Any help would be greatly appreciated.

This was solved by using a binding source like so.

Dim bs As New BindingSource
bs.DataSource = Entries
DataGridView1.DataSource = bs

And then reassigning the data source each time.

Public Sub Grid_Update()
    bs = New BindingSource
    bs.DataSource = Entries
    DataGridView1.DataSource = bs
End Sub
Était-ce utile?

La solution

Re assign grid source to updated list of objects and call databind method again.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top