I struggle with the datagrid, it seems like it is very fragile on changing
data in the datasource...

Is there some guidelines on how to use the datagrid out there somewhere?

What I want to accomplish is this:
- Show a list of objects. Each list entry will show a subset of object's
properties.
- Select a list item. This will populate edit fields another place on form.
- Edit fields, commit changes to database.
- Update datagrid, preferely keeping the selected item.

variations (1):
- Create a new object, this will only clear edit fields in the first place
- Edit fields, commit changes to database. This will add a new row.
- Update datagrid, preferely with the new item selected.

variations (2):
- Select a list item
- Delete it. This will remove a row in database.
- Update datagrid, preferely with closest item to the deleted one being
selected

Trial 1 - Bind a data table:
- Bind a datatable to grid.
- Update database.
- Use adapter.Fill to refresh table.

This works on Add and Update, but not delete. For some reason adapter.Fill
will not remove nonexisting item.

Trial 2 - Bind a data table, clear table
- Same as one, but do a table.Clear before adapter.Fill when deleting.

DataGrid throws an array out of bounds exception whenever I click it after a
deletion.

Trial 3 - Bind a data table, use table.Delete (or was it row.Delete?)
- Bind a datatable to grid.
- Use adapter.Fill when adding or updating
- Use table.Delete when deleting

DataGrid seem to accept this approach, but now I have two different ways to
update the database:
- When I add or update I notify table of changes. Table is passive.
- When I delete, I first have to delete row from table, then use the table
to notify database. Now table is active.

Trial 4 - Bind a list (yet to try):
- The idea is to bind an ArrayList to grid.

I haven't tried this path yet. Seem to be too much of manual syncronations:
- Commit edits to database, refill list object with data from database
- Commit deletion to database, if successfull then remove object from list
- Notify datagrid that data has changed.

..thomas