Object variable or With block variable not set when referencing dll directly
-
Friday, August 22, 2008 12:19 AM
Hi all,
I have a situation where I'm getting an error when I reference an InterOp dll, however when I call methds on objects in the dll when it is running the VB5 debugger, I do not get the error. Can any one help with this as I'm really stumped ?
The error which I get is "Object variable or With block variable not set"
Example code is :-
imports DRSSWorkflowBODim objEpisodeBO as clsEpisodeBO
objEpisodeBO = new clsEpisodeBO
objEpisodeBO.Load(strCurrentEpisodeID) 'this line fails when the COM dll is not running in a VB5 debugger
Note that objEpisodeBO is not Nothing.
Why should running a DLL in the VB5 debugger fix the problem ?
Any ideas would be appreciated.
Thanks,
Alastair
All Replies
-
Friday, August 22, 2008 9:43 AM
I've fixed this now. The problem was due to initialisation being performed by a class that was declared locally instead of at class level in .NET. When I moved the declaration for within a sub to Class level the problem resolved.
I can't explain why this fixed it, but it did. I don't like "inexplicable" problems like this but am pleased that it works now.
Thanks to any who check this out.
Alastair.- Marked As Answer by Alastair01 Friday, August 22, 2008 9:44 AM

