LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"System.__ComObject"

I have some database and libraries for operation with it. If I write a macro in Exlel all works correctly and similarly in LV incorrectly.
Here the code in VB:

 

Private Sub CommandButton1_Click()
Dim srv As Server
Set srv = Servers.DefaultServer
Cells(1, 3) = srv.PIPoints(CStr(Cells(1, 1))).Data.Snapshot
' Where CStr(Cells(1, 1)) = BA:CONC.1

 

And if the object contains simply numerical or string values that is read out correctly. If an element of type of date(or some other) not correctly indicator "tostring" produces value "System. __ ComObject". Though for a macro in VB it doesn't influence in any way.

 

Download All
0 Kudos
Message 1 of 13
(4,290 Views)

Hey Mike,

Can you expand more on what happens in LabVIEW? Does an error pop up in LabVIEW? If so what is its associated code?

What toolkits or modules are you using for this program?

If you have anymore information, that can help narrow down what is happening.

Thanks,

Ricky

National Instruments
Applications Engineer
0 Kudos
Message 2 of 13
(4,251 Views)

No there is no error . But value on "value out" indicator is not correct.  In this case it mast be "01.01.1970 3:00:00" but it is "System.__ComObject"(see Error.jpg). I use only net library(it is library for database) and standart LV Net functions. In VBA all works correctly.

Download All
0 Kudos
Message 3 of 13
(4,241 Views)
0 Kudos
Message 4 of 13
(4,237 Views)

What version of .NET was used to create the assembly? The issue you're having is that Value is coming out as the generic "Object" class, and that class has a generic ToString() method, and that's what you're seeing.

0 Kudos
Message 5 of 13
(4,221 Views)

I don't know what version of .NET was used to create the assembly. It was delivered with a database. How I can obtain the demanded data?

0 Kudos
Message 6 of 13
(4,207 Views)

You can try using the To More Specific Class function to cast the returned class to the class it should be.

Message 7 of 13
(4,199 Views)

Thanks, it have helped.

 

But I have other problem:
Promt please as I can make such action in LV
 VBA code:

 

Set srv = PISDK.Servers("MyServerName")

 

I should use LV functions or my assembly? In assembly there are properties and methods (see Prop&metods.JPG ) but they don't approach.

0 Kudos
Message 8 of 13
(4,173 Views)

That line is a constructor line, not a method line. You have to select the constructor that has a string parameter, as opposed to the constructor that has no parameters (as you currently have).

0 Kudos
Message 9 of 13
(4,163 Views)

I have found in help file for my assembly that a property "get item"

equally to  VBA code: Set srv = PISDK.Servers("MyServerName")
(see helpfile.txt).  

But when I use this property in LV I receive an error 1172(see error1172.jpg). LV and the server are installed locally on my computer.
How to rectify this error?

 

Download All
0 Kudos
Message 10 of 13
(4,139 Views)