By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

ApplicationException

P: n/a
Hey folks,

Building my own exception class that inherits from ApplicationException, but
includes a few extra properties I create, such as IPAddress and such. I
want to define a couple different "New" subroutines to be able to capture
all the elements of the error that happened, and the extra data. Problem
is, it won't let me do:

Public Sub New(ByVal ex as Exception)
Me = ex
End Sub

Or

Public Sub New(ByVal ex as Exception, ByVal IPAddress as String)
Me = ex
m_IPAddress = IPAddress
End Sub

How can I easily set all the properties of the exception passed into my
"TransferException" without setting every single property by hand?

Thanks.

-Jason
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"OpticTygre" <op********@adelphia.net> schrieb:
How can I easily set all the properties of the exception passed into my
"TransferException" without setting every single property by hand?


Instead of setting all the properties add the exception to your exception's
'InnerException' property.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
Ahh, good idea. Will that InnerException have its own InnerException
property (the InnerException of the original Exception)?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OZ**************@TK2MSFTNGP10.phx.gbl...
"OpticTygre" <op********@adelphia.net> schrieb:
How can I easily set all the properties of the exception passed into my
"TransferException" without setting every single property by hand?


Instead of setting all the properties add the exception to your
exception's 'InnerException' property.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
"OpticTygre" <op********@adelphia.net> schrieb:
Ahh, good idea. Will that InnerException have its own InnerException
property (the InnerException of the original Exception)?


Yes.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.