Example Code

Programmatically Write Values to a Multicolumn Listbox

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.


  • LabVIEW

Code and Documents



This example allows the user to write values to a listbox programmatically without generating a new control. The values are stored in the Array object associated with the listbox and can be reset to blank using the same method for initialization.




A listbox can be used to store information in a 2D spreadsheet format and act as an input to other functions that want to modify or parse a large amount of information. This program takes advantage of the array object used to define the items in the listbox. At the start of execution, a 500x500 array constant with a value stored in the cell at row 500 column 500 is passed in to the array object of the listbox. The array has to have a value in that cell in order to initialize all the cells in the 500x500 space, which allows them to be editable during runtime. After the initialization step, the code enters a loop that waits for button press events. In the "Update" event case, the array object is accessed using the row and column user input information and a user defined value is stored there. In the "Clear" case the array object gets reinitialized to the same state as in the beginning.




LabVIEW 2012 (or compatible)



Steps to Implement or Execute Code

  1. Click the Run button
  2. Enter in a Row and Column Values
  3. Enter in a value to be stored in the cell you defined earlier
  4. Press the "Update" button
  5. Note: You may need to move the scrollbars if you can't see the cell you are targeting.



Additional Information or References

Front Panel



Block Diagram






**This document has been updated to meet the current required format for the NI Code Exchange. **

Bryan H.

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


It appears that this only works for column <4 and row <5. Is this a bug or am I missing something? Any ideas? Thanks!