LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use treeview .net control

Solved!
Go to solution

Hi All,

 

I want to use .net treeview control in my application. In treeview, I want to show the test carried out. Each test will have a child nodes indicating the steps involed in the test. I want to know that how I can add child nodes to treeview.

 

Thnaks.

Shrinivas

0 Kudos
Message 1 of 15
(6,370 Views)

Why don't you use LabVIEWs Tree Control, there are many examples available.

 

Christian

0 Kudos
Message 2 of 15
(6,361 Views)

Thanks  for reply.

 

In .net treeview control you can have check boxes directly to node & we check which nodes are selected. But in labview we need to assign image for check box, also it requires different images for checked & unchecked check box.

 

Thanks,

Shrinivas

0 Kudos
Message 3 of 15
(6,359 Views)

It's possible to set custom Icons as we discussed in one of you other threads about this topic.

here > http://forums.ni.com/ni/board/message?board.id=170&message.id=437987#M437987

0 Kudos
Message 4 of 15
(6,347 Views)
Solution
Accepted by topic author Shrini

I don't think that will accomplish what the user is trying to do. If I understand correctly, I think the user wants to be able to check/uncheck boxes?

 

As far as the .NET Treeview control, like any other .NET control you need to place it inside a .NET container. Examples ship with LabVIEW on using .NET with LabVIEW. You should also read the section in the LabVIEW Help on how to use .NET in LabVIEW. As for the control itself, you need to look to MSDN for the documentation since it's a Microsoft control.  

 

Attached is a simple demo to get you started. Note that in a real program  you should be properly closing references and handling errors.

Message 5 of 15
(6,333 Views)

Thanks. I'll try the demo example.

 

Shrini.

0 Kudos
Message 6 of 15
(6,307 Views)
I've used the demo code and able to build the tree. But I'm facing problem, I want the Text & Tag of selected tree node. I'm getting only Text.
0 Kudos
Message 7 of 15
(6,298 Views)
As I had noted, you need to look at the MSDN documentation on how to program the TreeView control. The example I provided used the Add(string) method, which adds a node with just the text. If you want a key for the node you add then you need to select the Add(string, string) method in the Invoke nodes.
Message 8 of 15
(6,282 Views)

Hi,

 

I've added tree nodes with Keys, but my problem is how to get Key of selected node.

e.g. Following is my tree

 

 

A 1

    AA 11

    AAA 12

    AAAA 13

B 2

    BB 22

    BBB 23

 

When I click on AAA 12 node; I should get Text as AAA & Key as 12. Right now I'm getting only AAA. In .net we can get this by Tag Property. Here Tag property is there, but it is not a string.

 

Thanks & Regards,

Shrinivas

 

0 Kudos
Message 9 of 15
(6,249 Views)
The return type for that property is the generic "Object" type, so LabVIEW doesn't know what to do with this. In .NET it's trivial to cast this to a string. In LabVIEW you have to use the .NET Object to Variant VI and the Variant to Data function:
Message 10 of 15
(6,232 Views)