Example Code

Duplicate Multiple Row of Listbox in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

I want to duplicate multiple rows of the Listbox in LabVIEW. For example, I going to select 3 data in Listbox and duplicate these data. However, I’m able to extract the first selected row number from the property node (Focus Row) but not the second and third data.

 

How to Use

  1. Connect the array indicator to the property <Value>. The array indicator will show the selected data row index.
  2. Extract and copy the selected data by using <ItemNames> property.
  3. Use Insert Into Array function to insert selected data into Listbox.

 

Additional Information

If the array indicator connects to <Value> properties of Listbox, it will show the selected data row index array. However, if there's a Listbox indicator will show the selected data as Listbox controls.

 

Since the array index number is started from 0, so the desired position of the duplicate data should always -1.

For example, if want to locate duplicate data on the top of the Listbox, the index number of the Insert into the array should be 0.

If the first and second elements were selected and duplicated, then these data were inserted into position after the original first data. The index number of the insert into the array should be 1.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.