NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

What does user-defined error code: -2146828190 mean?

Hi,
 
I'm using Teststand 3.5 and I'm using ActiveX/COM Steps in sequence editor. In one of my steps, I'm calling a method from one of my objects that returns a reference to an interface. When I run this particular step, I get an error with the message "-2146828190; User-defined error code" in the error dialog. Teststand doesn't give me any further details on the error other than where it occurs. The object and method are from a VB ActiveX dll.
0 Kudos
Message 1 of 12
(4,211 Views)
Hi,
 
It appears that someone defined that number as an error code in the dll that you are using. 
Do you have access to the source code for that dll?
 
JLV
Message 2 of 12
(4,200 Views)
JLV,
 
Yes I do have the source code, but that error code is not defined anywhere in it. Any user-defined error thrown by the dll (that I know of) has an user-defined message associated with it and is shown in the error dialog. The error that I get doesn't come with a message.
0 Kudos
Message 3 of 12
(4,196 Views)

Hi ysh,

Do you receive this error when you call just this individual method or any method associated with your dll? I have attached a example program that calls a VB DLL from TestStand. You just need to register the DLL with Windows. If this example works for you, then we can determine that there is an issue with your DLL and not TestStand.

Let me know what happens!

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 4 of 12
(4,187 Views)

Jonathan,

I only get this error when I call this particular kind of method. Other methods work fine. I don't get an error when my method returns a reference to an object. I only get the error when my method returns a reference to an interface. Here is a prototype of the method that is causing troubles:

Public Property Get Item() As ImyInterface

The dll was written in VB 6.0.

I've tried running your example and I get the error: "Create New Object" in automation call failed. Class not registered. It occurs at the first step.

0 Kudos
Message 5 of 12
(4,178 Views)

Hi ysh,

You have to register the dll first before running the sequence. Refer to this link for that.  Is it possible for you to post a small snippet of code that replicates the issue so I can try and reproduce your behavior here? Thanks

Best Regards, 

Jonathan N.
National Instruments
0 Kudos
Message 6 of 12
(4,175 Views)
Jonathan,
 
Yes, the example you sent me works. I've attached to this message a sample of the code that generates the error in TestStand.
0 Kudos
Message 7 of 12
(4,169 Views)

Hi ysh,

I had R&D look at your code with me and it appears to be something in your code that is incorrect. We tested out your DLL in both TestStand and LabVIEW and got the same "Object variable or With block variable not set" message. We even tested that code in Visual Basic itself using the syntax

Private Sub Form_Load()
Dim x As New clsCallClass
Dim y As ImyInterface
y = x.Item
End Sub

Therefore you will need to refer to some Visual Basic documentation to see why the error occurs. This msdn document talks about this concept.

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 8 of 12
(4,148 Views)
Jonathan,
 
I do not get this error in VB 6.0. Try this:
 
Private Sub Form_Load()
    Dim x As New clsCallClass
    Dim y As clsImplementInt
    Set y = x.Item
End Sub
0 Kudos
Message 9 of 12
(4,145 Views)

Hi ysh,

I am sorry but we still get that same error when we create a new project that is for an exe, add the code you mentioned to our form code, add the reference to the dll created by your project, and then run it. We get the same error in several different environments.

Best Regards,

 

Jonathan N.
National Instruments
0 Kudos
Message 10 of 12
(4,137 Views)