02-04-2011 09:14 AM
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.
02-07-2011 02:46 PM
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
02-08-2011 11:36 AM
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.
02-08-2011 11:40 AM
02-08-2011 12:42 PM
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.
02-08-2011 02:13 PM
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?
02-08-2011 03:43 PM
You can try using the To More Specific Class function to cast the returned class to the class it should be.
02-10-2011 12:47 PM - edited 02-10-2011 12:53 PM
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.
02-10-2011 01:41 PM
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).
02-13-2011 03:19 AM - edited 02-13-2011 03:26 AM
I have found in help file for my assembly that a property "get item"
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?