Robin,
In the WinForm, I used:
private void dockBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
Dock dock = new Dock();
dockBS.EndEdit();
dock.UpdateDocks(dockBS.DataSource as BindingList<Dock>);
}
and in the Dock class located in a separate DLL, I used:
public void UpdateDocks(BindingList<Dock> docks)
{
DockandSlipDS.DockTableDataTable table = new
DockandSlipDS.DockTableDataTable();
foreach( Dock dock in docks)
{
DockandSlipDS.DockTableRow row = table.NewDockTableRow();
row.DockId = dock.DockID;
row.Location = dock.Location;
row.Electricity = dock.Electricity;
row.Water = dock.Water;
table.AddDockTableRow( row );
}
_dockTA.Update( table );
}
I guess I need a way to scan through each dock in the docks BindingList and
determine the rowstate. But I can't find a way to get the rowstate of the
returned. I don't have the two books you mentioned. Would it be possible
for you to give me some sample code for adding a rowstate detection event
inside
the Dock class to capture any change of rowstate.
Also, can you show me how you keep track of changes using another list while
we are using a BindingSource. A small example will be greatly appreciated.
Cheers,
Alan L.
RobinS wrote:
>>I created an object using BindingList<T> for GetObjects() and assigned
>>that
>[quoted text clipped - 24 lines]
>>
>> Any suggestions or comments will be greatly appreciated.
>
>How are you trying to save the datasource? I am doing the same thing. I am
>not using DataSets, though. I am handling the updates myself, in the class
>for the object. I have a property in my class telling if the row was added
>or modified. When they delete entries from my grid, I am saving those in
>another list. When they hit save, I go through the list and perform the
>inserts and updates, and then do the deletes of the deleted entries. So I
>cache them and do them all at the end.
>
>To set the rowstate, I'm capturing events on the list. My list is defined
>as a BindingList(Of Company).
>
>I figured this out using examples in Brian Noyes' data binding book, and
>Chris Sells' Windows Forms 2.0 book. You don't have either of those, do
>you?
>
>Robin S.
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...users/200702/1