11-21-2012 08:58 AM
Hi,
Im having problems with input to .NET library, type of this input is dictionary. When im trying to create method to add item to dictionary im getting error
Error 1172 occurred at Error calling method System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Add, (System.ArgumentNullException: Klucz nie może być zerowy.
Nazwa parametru: key)
Im just wondering if i can use this .net library with dictionary or i need to get this lib modifited to fit with some kind of standart data type?
11-21-2012 09:22 AM
A VI would be preferable and preferably not a VI in LV2012 since not everybody has the latest rev.
11-21-2012 10:17 AM
Your question is a little unclear but I am including a VI which shows how to do the following
VI is LAbVIEW 2010 SP1
11-21-2012 11:01 AM
It would appear from the picture of your VI that you have simply created constants for your dictionary object which is a null refnum (hence explaining your error). You must instantiate the dictionary object to get that reference. LabVIEW for some unknown reason refers to instantiation as a "Constructor node". Drop a constructor node (from the .Net palette) onto your block diagram and select the appropriate object to instantiate.
11-22-2012 01:35 AM
Hi,
That was first what i done, but there is no Dictionary under MSCOR.lib>System.Collections.Generic so I would like to know if I need to create it somehow? Or there is something wrong with my system or/and LabView?
I attached screenshot
11-22-2012 03:03 AM
The .Net Dictionary requires Key and Value types defined at the time of creation. I'm not sure if this is possible under LabVIEW
.Net example
Dictionary<String, String> d = new Dictionary<String, String>();
11-23-2012 02:01 PM - edited 11-23-2012 02:05 PM