キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

.NET constructor node reporting no public constructors

解決済み
解決策を見る

Hi all.

I am trying to make a .NET call to Microsoft.Win32.RegistryKey within mscorlib(2.0.0.0).  MSDN shows that there are several properities and methods available to use.  However when attempting to create a .NET constructor in LabVIEW, RegisrtyKey is displaying "This class contains no public constructors."

 

I would like to call the method for GetSubKeyNames.

 

If anyone has any ideas, I would appriciate some assistance.  Thank you in advance.

 

 

Gregory Osenbach
0 件の賞賛
メッセージ1/10
6,439件の閲覧回数

Use the Windows Registry VIs in the Connectivity sub-menu.

aputman
0 件の賞賛
メッセージ2/10
6,430件の閲覧回数

Yes, but those only me to get the data from a key if I already know the entire path to the key if my understanding is correct.

 

In my suitiation, I need to be able to recursivly search through all the subkeys for keys with a specific names, and then get the values to those. 

 

Is there a way to do that with the built in VIs that I am overlooking?

 

Thanks.

Gregory Osenbach
0 件の賞賛
メッセージ3/10
6,416件の閲覧回数

Have you read through the documentation for the RegistryKey class?

 

http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey(v=vs.110).aspx

 

The documentation states that there is no public constructor for this class -  you have to request an instance using one of the static methods. You can see the static methods listed with "S" symbol next to them. The one you are after is probably RegistryKey.OpenBaseKey() method. Use and Invoke node and specify this static method. You can then call other methods on the returned object, including the GetSubKeyNames() instance method.

 

Or, as the last poster mentioned, just use the in-built LabVIEW functions if your need is simple enough.

 

0 件の賞賛
メッセージ4/10
6,413件の閲覧回数

Ahh..  ok, I see..  I need to be using the invoke node linked to the class rather than the .NET constructor.  Let me give that a shot.  Thanks.

Gregory Osenbach
メッセージ5/10
6,408件の閲覧回数
解決策
トピック作成者gosenbachが受理

This returns the top level keys in the registry.  You could design a VI that searches thru the registry for keys you need.

Capture.JPG

aputman
メッセージ6/10
6,407件の閲覧回数

Perfect.  I can work with that.  Thanks!

Gregory Osenbach
0 件の賞賛
メッセージ7/10
6,400件の閲覧回数

Hi 

 

I have had often the problem in .NET that I did not find the proper objects or it was said (non creatable object)

In this case it is possible to use a constant and then browse to the proper .NET class entry.

 

In the attchement I have given an example for the registry key you asked before.

 

I know that you already have a solution of this spesific problem but you may have a .NET command in future where the solution is not as easy as shown before.

 

Here you can see an alternative by .NET usage

 

Gernot Hanel

www.ionicon.com

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
メッセージ8/10
6,355件の閲覧回数

That is awesome and tricky nottilie.  Thanks!

Gregory Osenbach
0 件の賞賛
メッセージ9/10
6,332件の閲覧回数

This is indeed an awesome trick. I was thinking about doing the same thing, I just did not know where to get that constant.

So thank you and kudos, that's been really helpful.

 

I have been able to use this approach to get LabVIEW to activate a command prompt window, and send some keys (for a use case I have).

0 件の賞賛
メッセージ10/10
4,509件の閲覧回数