Home All Groups Group Topic Archive Search About

Catch Row validating exceptions

Author
10 Mar 2006 11:31 PM
KB
I am using a typed dataset and would like to perform some validations on a
row before it is edited or added to a datatable.  I have tried putting
validation in the RowUpdating event (using SetColumnError) however this
doesn't block the row from being added.  If I throw an exception this does
block the add, but I can't see to find how to catch the exception because it
throws the exception outside of the addrow inline code.  ANy help?

I can't do this because the exception will get thrown in an event outside
the calling method.

Try
   AddRowtoTable()

Catch Ex As Exception
  'failed to add row because of validation issue
End Try

Author
11 Mar 2006 1:09 PM
Cor Ligthert [MVP]
KB,

Why not go trough it in a for index loop, if you cannot find a field, than
know that a STD inherits a normal Dataset.

Cor

Show quote
"KB" <K*@discussions.microsoft.com> schreef in bericht
news:F84D075D-396C-4D7E-9ECA-A40873C1544E@microsoft.com...
>
> I am using a typed dataset and would like to perform some validations on a
> row before it is edited or added to a datatable.  I have tried putting
> validation in the RowUpdating event (using SetColumnError) however this
> doesn't block the row from being added.  If I throw an exception this does
> block the add, but I can't see to find how to catch the exception because
> it
> throws the exception outside of the addrow inline code.  ANy help?
>
> I can't do this because the exception will get thrown in an event outside
> the calling method.
>
> Try
>   AddRowtoTable()
>
> Catch Ex As Exception
>  'failed to add row because of validation issue
> End Try
>

AddThis Social Bookmark Button