From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Radio button refnum control

Hi friends,

          I`m trying to get the value of radio button reference in a subVI connected in form of cluster. When I try to run it I`m getting an object reference error. I`ve attached the  snippet of my VI`s. Guide me in resolving it.

 

Regards Ganesh

Download All
0 Kudos
Message 1 of 9
(3,618 Views)

You may get the object reference error when you pass a Null reference. Check whether you have connected the reference and passing it properly. At the place where you are getting the error you can probe the reference and check it is not equal to 0. You can always use the function "Not a Number/Path/Refnum?" to check for valid reference.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(3,605 Views)

I hope then i`m going wrong in creating the refnum of the radio button in the sub VI. I used control refnum right click select VI server class-> Generic-> GObject-> control->cluster->radio buttons is this correct way to create the reference control in a subVI.

0 Kudos
Message 3 of 9
(3,573 Views)

Generally the best way to create a control refnum constant is directly from the control itself. Right-click the control and create a reference, then right-click the reference and create a constant from it.

0 Kudos
Message 4 of 9
(3,563 Views)

Hi Nanthand,

                 Yeah i`ve created the same way as you described and made into cluster. In a SubVI we need to create a Control Refnum to pass the reference from the MainVI. I created that as I discussed in my


@nathand wrote:

Generally the best way to create a control refnum constant is directly from the control itself. Right-click the control and create a reference, then right-click the reference and create a constant from it.



previous post.

0 Kudos
Message 5 of 9
(3,545 Views)

You should create the control the same way you created the constant, directly from a reference to the original control, or by taking a copy of the constant and changing it to a control.

0 Kudos
Message 6 of 9
(3,529 Views)

This way it works, but is it correct way of programming?

0 Kudos
Message 7 of 9
(3,516 Views)

@gnshmrthy wrote:

This way it works, but is it correct way of programming?


Not really. Replace the Build Array with Bundle so you'll have a cluster instead of an array, and remove the other cluster constant input.

0 Kudos
Message 8 of 9
(3,502 Views)

Yeah I did that as suggested at LAVA http://lavag.org/topic/17705-radio-button-refnum/ thanks for the support. Kudos for the slution & support.

0 Kudos
Message 9 of 9
(3,469 Views)