Throwing an exception from a property

eric13

Active member
Joined
May 25, 2006
Messages
30
Programming Experience
3-5
I have a collection of business objects bound to a form with a bindingsource and a navigator.

I want to throw an exception (some message) to the owning application when a user attempts to set a property with invalid data. What is the proper way to throw the exception from the property and handle it on the owning app.






 
Exactly as you have said in your post...

VB.NET:
Throw New InvalidOperationException(..)
You can ofcourse create your own custom exception class if you want the exception to be a bit more personalised.
 
Back
Top