473,387 Members | 1,876 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,387 software developers and data experts.

COM-Interop: How to pass on / throw exceptions?

Hi folks,

I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or pass on
exceptions from within the .Net-DLL, all I get is Err #440 ("Automation
Error").

I'm passing on exceptions like this:
Throw ex
.... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in VBA ..?

Also, the GetLastError-API doesn't return anything either, that is, I'll
always get #0 (= everything alright).

Cheers,
Olaf
Jan 29 '07 #1
5 1739
Hi,

Olaf Rabbachin wrote:
I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or pass on
exceptions from within the .Net-DLL, all I get is Err #440 ("Automation
Error").

I'm passing on exceptions like this:
Throw ex
... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in VBA ..?

Also, the GetLastError-API doesn't return anything either, that is, I'll
always get #0 (= everything alright).
sniff, no insights, anybody ..?

Cheers,
Olaf
Feb 1 '07 #2
Olaf Rabbachin wrote:
<snip>
I'm passing on exceptions like this:
<snip>
<snip>
sniff, no insights, anybody ..?
=))))

I've been to a couple of sites researching your question in the last
few days, but something or other interrupted me before I had a
definitive answer. I suggest you don't reliquish the faith... ;-)

Regards,

Branco,

Feb 1 '07 #3
"Olaf Rabbachin" <Ol*********@IntuiDev.comschrieb
Hi,

Olaf Rabbachin wrote:
I have a (VB.Net-) DLL that I'm using from MS Access 2003.
Everything's pretty fine except for one thing - When I throw or
pass on exceptions from within the .Net-DLL, all I get is Err #440
("Automation Error").

I'm passing on exceptions like this:
Throw ex
... and I'm throwing my own exceptions like this:
Throw New ExternalException("Oops", [some enum])

Is there something wrong with that, or why do I only get #440 in
VBA ..?

Also, the GetLastError-API doesn't return anything either, that
is, I'll always get #0 (= everything alright).

sniff, no insights, anybody ..?
Hi, me again ;-) Maybe you can try in the m.p.d.framework.interop group.
Armin
Feb 2 '07 #4
Hi Branco,

Branco Medeiros wrote:
>sniff, no insights, anybody ..?

=))))

I've been to a couple of sites researching your question in the last
few days, but something or other interrupted me before I had a
definitive answer. I suggest you don't reliquish the faith... ;-)
thanks for your efforts. And no, I won't loose faith. Actually I worked
around this by using my own properties that will be queried from my VBA-app
when an exception is thrown. It's just that I consider the approach to be
very bad design and I don't see why this shouldn't work as expected in the
first place. :-)
Also, I opened another thread in a german NG where Armin also tries to
help. Just thought there should really be other people with the same
problem ...

Cheers,
Olaf
Feb 3 '07 #5
reliquish Hi,

Armin Zingler wrote:
Hi, me again ;-) Maybe you can try in the m.p.d.framework.interop group.
ah, good idea - thanks!

Cheers,
Olaf
Feb 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andy Howells | last post by:
Can anybody help me on this? I am getting the below error but have not got a clue why. The file in my classpath eing used has the class that it says is not defined. Any ideas? I am running java...
0
by: Randy Roman | last post by:
Hello to all. I have a nagging problem concerning where to call CoUninitialize() COM function. I realize that this may be more of a C++/COM question rather than a Java question, but I just thought...
1
by: Noah | last post by:
Hi, How do I shutdown a win32 COM server? I am scripting Adobe Illustrator through its COM interface. The problem is that Illustrator has memory leaks. And after a few hours of running,...
0
by: Brent Turner | last post by:
Under python 2.2 I was able to create a COM object in an exe much of the same way that I could from py source... meaning that I was able to register the com server and create an instance using...
5
by: Andre Bernemann | last post by:
Hi, I have written a Python COM Server with the help of Mark Hammond's Book Programming Python on Win32. I used the CreateObjects method in VB to access the COM Methods and all worked fine....
26
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using...
13
by: Kyle Adams | last post by:
I don't know where is the right place to ask this so I will start here. Can someone explain to me what these represent? I think they all have to do with the middleware level, but I really don't...
0
by: jfranco | last post by:
GANHE DINHEIRO COM A INTERNET E AJUDA MÚTUA! Pode parecer mais uma daquelas falsas notícias que você vê por aí, MAS POR FAVOR LEIA este texto para entender, é muito fácil, simples e funciona!! O...
0
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album below for our product list. trainers supplier...
0
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album below for our product list. trainers supplier...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.