Groups | Blog | Home
all groups > vb.net data > december 2004 >

vb.net data : DataTable and DataColumn event


jcvoon_99 NO[at]SPAM yahoo.com
12/9/2004 10:47:10 AM
Hi:

I'm from Delphi world, In Delphi TDataSet (similler to DataTable) I
can use the following event

BeforeInsert, AfterInsert :
Trigger before and after add a new record into data table, in the
BeforeInsert event i can raise an exception to stop the Add action

BeforeDelete, AfterDelete :
Trigger before and after the record has been delete from the data
table, in the BeforeDelete event i can raise an exception to stop the
Delete action

BeforePost, AfterPost :
Trigger before and after the record save into the data table, in the
BeforePost event i can raise an exception to stop the Post action

BeforeCancel, AfterCancel :
Trigger before and after the cancel the current changes, in the
BeforeCancel event i can raise an exception to stop the Cancel action

And In the TDataField (similler to DataColumn) i can have

OnValidate event to do field validation, if an exception is raise in
this event the bound control will remain focus, if the data column is
edit in grid the validation will cause the cell position remain on the
invalid cell, if i change the value in code, this event will trigger
too.

So, How can i simulate those event in .Net DataTable ? Please Help.

Thank
Ken Tucker [MVP]
12/10/2004 11:42:29 PM
Hi,

Take a look at the currencymanagers itemchanged and dataadapter's
rowupdating events.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqldataadapterclassonrowupdatingtopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsCurrencyManagerClassItemChangedTopic.asp

Ken
----------------------
[quoted text, click to view]
Hi:

I'm from Delphi world, In Delphi TDataSet (similler to DataTable) I
can use the following event

BeforeInsert, AfterInsert :
Trigger before and after add a new record into data table, in the
BeforeInsert event i can raise an exception to stop the Add action

BeforeDelete, AfterDelete :
Trigger before and after the record has been delete from the data
table, in the BeforeDelete event i can raise an exception to stop the
Delete action

BeforePost, AfterPost :
Trigger before and after the record save into the data table, in the
BeforePost event i can raise an exception to stop the Post action

BeforeCancel, AfterCancel :
Trigger before and after the cancel the current changes, in the
BeforeCancel event i can raise an exception to stop the Cancel action

And In the TDataField (similler to DataColumn) i can have

OnValidate event to do field validation, if an exception is raise in
this event the bound control will remain focus, if the data column is
edit in grid the validation will cause the cell position remain on the
invalid cell, if i change the value in code, this event will trigger
too.

So, How can i simulate those event in .Net DataTable ? Please Help.

Thank
JCVoon

AddThis Social Bookmark Button