473,321 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

ApplicationException

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
3 1302
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Russell Mangel | last post by:
Jeffery Richter makes the following statement in two books, the first was written in 2004, the latter in 2002. "You should not define new exception classes derived from ApplicationException; use...
2
by: Charles | last post by:
I need to find a way to share information between two classes, one is an employee class and the other is a custom error class that inherits from ApplicationException. These two classes are part of...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
4
by: Tad Marshall | last post by:
Hi, I'm having limited luck getting an ApplicationException to work right in my code. This is VB.NET, VS 2003, Windows XP SP2, .NET Framework 1.1. I thought it would be convenient to take...
13
by: Alison Givens | last post by:
....... that nobody knows the answer. I can't imagine that I am the only one that uses parameters in CR. So, my question again: I have the following problem. (VB.NET 2003 with CR) I have a...
0
by: Dave | last post by:
I have two prorams, one of which runs as a service, and the uses a shared resource (actually a log file) which I want to protect with a named mutex. The service starts at login, and when I run the...
4
by: Jen | last post by:
My ASP.NET/VB.NET web application has been running fine until today. When I go to the intranet site's start page, I get a "Server Error in /AppName" error and the text for the error reads "The...
4
by: bg_ie | last post by:
Hi, I have the following Program.cs - namespace TestFrameworkApplication { static class Program { /// <summary> /// The main entry point for the application.
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.