LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Dictionary class

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?

 

 

 

Download All
0 Kudos
Message 1 of 7
(3,449 Views)

A VI would be preferable and preferably not a VI in LV2012 since not everybody has the latest rev.

 

 

0 Kudos
Message 2 of 7
(3,443 Views)

Your question is a little unclear but I am including a VI which shows how to do the following

  • List all directories under the current path
  • Create a Tmp folder under C root
  • List all the files under C root
  • Creats a TestFile.txt inside folder c:\Temp

VI is LAbVIEW 2010 SP1

0 Kudos
Message 3 of 7
(3,436 Views)

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.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 4 of 7
(3,420 Views)

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

0 Kudos
Message 5 of 7
(3,396 Views)

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>();

 

 

0 Kudos
Message 6 of 7
(3,390 Views)

This article states that Generics are not possible to be supported by the constructor node and for method calls.

Rolf Kalbermatter
My Blog
Message 7 of 7
(3,373 Views)