Handling .NET Exceptions in VB6


hi,

i have question regarding how vb6 handles exceptions raised .net component.

this scenario: have legacy vb6 app writing new functionality in managed assembly , accessing through com. in vb6 code used on error goto extensively , there places responding data access errors - kind come sqlserver stored procedure. specifially sp performs raiserror(50000,16,1) , vb6 code (inside error routine) handles err.number when 50000.

my .net component replaces direct call sp wanted keep vb6 code it, i.e. still responding err.number being 50000. problem seem have when .net component throws exception cannot err.number 50000. know if used comexception specify error code here error code must < 0 com error happen.

after that, guess need know if possible managed code raise vb6 error vb6 err.number positive?

thanks in advance

graham

hello graham,

sorry delay. wanted verify vb.net team :)

there breaking change made vb.net runtime whidbey (visual studio 2005) maintain compatibility vb6. clear, whidbey vb.net runtime break compatibility vb.net (everett 1.x), , return compatibility vb6.

if try code whidbey (which has not yet rtmd, betas available), should work expect.

if cannot wait or rely on vb.net whidbey, have option [in source code]. peek exception retrieve hresult , manually set error object:


dim c as new system.runtime.interopservices.comexception
err.number = c.errorcode

 


please feel free post forum if have questions or comments on issue.

hope helps,
stephen
http://blogs.msdn.com/stfisher



.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'