This should be simple, but I cannot figure it out. Given a datagrid, bound
to an arraylist, how should I go about inserting a new row above a selected
row?
Thanks,
Steve
Hi,
IMO, since ArrayList isn't implementing IBindingList interface there is a
problem with adding and removing its items in DataGrid. You could create
your own list and implement IBindingList there in order to solve this
problem. Another quick workaround is to "rebind" arraylist each time you
adding a new row. Here's an example:
_____________________________
ArrayList mList = new ArrayList();
{...}
mList.Add(new MyItem(...));
dataGrid1.DataSource = null;
dataGrid1.DataSource = mList;
dataGrid1.Select(mList.Count-1);
where dataGrid1 is
System.Windows.Forms.DataGrid
_____________________________
hope this helps
Best regards, Serge Gubenko
> This should be simple, but I cannot figure it out. Given a datagrid, bound
> to an arraylist, how should I go about inserting a new row above a selected
[quoted text clipped - 3 lines]
>
> Steve