all groups > asp.net webcontrols > october 2003 >
You're in the

asp.net webcontrols

group:

throw exception back to the page


throw exception back to the page SteveS
10/27/2003 8:52:15 AM
asp.net webcontrols:
Hello,

I created a user control where there are several text boxes and a button.
When the user clicks the button, I want to validate the data. When the the
data is not valid, I would like to throw an exception. Is there a way to
handle that exception on the main page? In other words, after the code
throw new excpetion("you data is screwed up"), I would like to hit code on
the main page to handle it.

Thank you,

SteveS
ssinger@trendmls.com

throw exception back to the page anonymous NO[at]SPAM discussions.microsoft.com
10/27/2003 7:59:26 PM
Hi Steve,

You can have your own Exception, just like the one used
in the Catch statement.

Try

Catch ex as Exception

End Try

As the Message property of the Exception eobjkect is read-
only,

[quoted text, click to view]
throw exception back to the page anonymous NO[at]SPAM discussions.microsoft.com
10/27/2003 8:00:56 PM
Sorry Steve,


Hit Send (enter) by mistake !)

Here is how :

-----------------------

Dim oExcep as Exception

oExcep = New Exception("you data is screwed up")

Throw oExcep

-----------------------

Hope this helps !

Ben


[quoted text, click to view]
AddThis Social Bookmark Button