Error handling in .net Class Library / Visual Basic

S

simonrobshaw

Hi,

I need some help in making a design choice for a project which we are
currently working on.
My client has a VB6 application which we don't see them actually
changing in the near future.

They are asking us to produce an dll interface component to interface
directly with the vb6 app. Now initial thoughs were to write the dll in
VB6 and have done with it. However Vb6 resources are thin on the ground
now and we have mainly c# developers around.

I understand a bit about .net error handling and have read an article
about Vb6 using .net class library's. The one specific requirement we
have though is if say a file is not found, we need to raise error code
12000 (ERR_IO) back to the Vb6 app so they can manage the error. The
world of .net error handling looks different and I can't off hand see
how I might invoke an error in .net which can then be managed
meaningful in VB6.

Can anyone help.

Regards
 
D

DeveloperX

Try this:
throw(new System.Runtime.InteropServices.COMException("an error",
vbObjectError + 12000));

vbObjectError is -2147221504 I believe from a google, I imagine it's
defined in one of the vb.net runtime libraries, but I didn't look.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top