Hello,
I'm trying to implement
RowDeletedEvent on Table. Idea is to take same action after user deletes record.
I tried this code:
private void AddHandlerToRowDel()
{
table = Session.Current.Catalog.OpenTable(tableFullPath);
if (table == null)
return;
table.RowDeletedEvent += Table_RowDeletedEvent;
}
private void Table_RowDeletedEvent(object sender, RowDeletedTableEventArgs e)
{
//Take action
}
However, this doesn't raise the event after I delete object from (linked) table. Then I thought maybe I should save changes in order to trigger the event, but I got this message:
"Cannot access file Points.DAT for writing. Please be sure that this file is not open in another application."This made me think it's because Table.OpenTable() locks .DAT file, however I found this in
ExtensibilityReferenceHelp:
"
An open table does not imply that the files containing the data are held open for the duration the table is "open". An open table simply means that a table (MapInfo native data, RDB server table, etc.) has been made known to the`` Catalog as a table that the user wishes to interact with.", so it shouldn't lock .DAT file, right?
Just to test, I added
TableIsClosingEvent to table, and when I close table in MapInfo event doesn't fire. So, I added
table.Close() in my code and that's when event gets triggered. This probably means that
RowDeletedEvent is raised when you call
Table.DeleteFeature()?
------------------------------
Miroslav Kovacevic
Knowledge Community Shared Account
------------------------------