Hi,
I am relatively new to C# and winforms, although I have been using Java for years, so forgive me if im asking something relatively straightforward!
I have a DataGridView, it needs to update regularly so I wish to provide a Collection of objects as its DataSource and NOT a database table.
So far I have a List<MyObject> which will be constantly updated via a BackgroundWorker thread. I want my DataGridView to update when a change has been made to the List i.e. if the objects are resorted, added to or deleted from etc.
Currently my DataGridView only displays the first object I add to the List, if I add more the DataGridView doesn't update to display the new objects added.
This is a basic overview of how im coding it:
private List<MyObject> myList= new List<MyObject>();
myDataGridView.DataSource = myList;
Then my BackgroundWorker thread updates the list, e.g.
myList.Add(new myObject);
So how do I tell the DataGridView to update what it displays when a change to the List is made?
Thanks!
I am relatively new to C# and winforms, although I have been using Java for years, so forgive me if im asking something relatively straightforward!
I have a DataGridView, it needs to update regularly so I wish to provide a Collection of objects as its DataSource and NOT a database table.
So far I have a List<MyObject> which will be constantly updated via a BackgroundWorker thread. I want my DataGridView to update when a change has been made to the List i.e. if the objects are resorted, added to or deleted from etc.
Currently my DataGridView only displays the first object I add to the List, if I add more the DataGridView doesn't update to display the new objects added.
This is a basic overview of how im coding it:
private List<MyObject> myList= new List<MyObject>();
myDataGridView.DataSource = myList;
Then my BackgroundWorker thread updates the list, e.g.
myList.Add(new myObject);
So how do I tell the DataGridView to update what it displays when a change to the List is made?
Thanks!