Hi all:

I am allowing a user to delete (indirectly) a row (representing a floor in a
building) from a data table (representing the floors in a building). To
delete the floor, the user displays the appropriate floor data and clicks the
delete button. The delete floor button click invokes the delete_floor
function, passing the floor number.

delete_floor first locates the appropriate row in the floor DataTable. When
the floor is found (it would be an error if it were not), the row is marked
for deletion, the deleted flag is set, and the for loop is exited. If the
deleted flag is set, the table's AcceptChanges method is invoked and the XML
data set (containing the table) is saved. The table is then retrieved, the
remaining floors are renumbered, the AcceptChanges method is invoked again,
and the XML data set is saved again.

Problem:

The row is not deleted. Following is the delete floor function - dwds is
declared as

private DeconUtilities.DW_DataSet dwds =
new DeconUtilities.DW_DataSet ( ) ;

Thoughts appreciated.

TIA

Gus

// ************************************************* delete_floor

public bool delete_floor ( int floor )
{
bool deleted = false ;
DataRow row ;
DataTable table = dwds.floor_data_table ;

if ( table != null )
{
for ( int i = 0; ( i < table.Rows.Count ); i++ )
{
row = table.Rows [ i ] ;
if ( floor.Equals (
Convert.ToInt32 (
row [ "floor" ] ) ) )
{
if ( deletion_confirmed ( floor ) )
{
row.Delete ( ) ;
deleted = true ;
}
break ;
}
}
}

if ( deleted )
{
table.AcceptChanges ( ) ;
dwds.save_XML_data_set ( ) ;
table = dwds.floor_data_table ;
if ( table != null )
{
for ( int i = 0; ( i < table.Rows.Count ); i++ )
{
row = table.Rows [ i ] ;
row [ "floor" ] = ( i + 1 ) ;
}
table.AcceptChanges ( ) ;
dwds.save_XML_data_set ( ) ;
}
}

return ( deleted ) ;
}