ArrayList to DataGrid

Apr 21 2004 12:11 AM
I have a question concerning the winforms datagrid control. I want the datagrid to bind to an ArrayList (which implements IList) instead of a Dataset. I do this with these lines: this.dataGrid1.DataSource = myArrayList; this.dataGrid1.DataMember = ""; At this point, the items in myArrayList are displayed on the datagrid. But, if I add or remove an item from myArrayList, this change is not reflected in the datagrid. When I bind a Dataset to a datagrid, I can add and remove rows, while the datagrid reflects what is in my Dataset. I am looking for the same functionality with myArrayList and the datagrid. There are a variety of reasons why I do not want to use a Dataset, such as, I am not hitting a data base, my object in the ArrayList is only four strings, and I feel if I get the functionality I want working, an ArrayList will be easier to manage. Any suggestions??? Should I use a different control?

Answers (1)