Winforms Datagridview Object Change

Hi – I have a datagridview that I have set to a list of objects. When the user creates a new list, or modifies the underlying object, I say

datagridview1.datasource = null; datagridview1.datasource = myobject.sublist; 

Unfortunately, this seems to be causing unpredictable crashes when the user clicks on the datagridview after a change to the object (and the above code is called), and it goes to “Application.Run(new Form1());” and gives a system.outofrange exception.

What could be causing this? Is there a better/different way I should be linking the datagridview to the object list?

submitted by /u/Haldiron
[link] [comments]

Leave a Reply