locked
Object variable or With block variable not set when referencing dll directly

    Question

  • 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 DRSSWorkflowBO

    Dim 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

    Friday, August 22, 2008 12:19 AM

Answers

  • 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
    Friday, August 22, 2008 9:43 AM