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: 

question about listbox

Hi i got a simple question about "listbox", i want to open a file (string) and show the contex in the list box, however, the property of the listbox is I32, how can i change the property to a string type? thanks,
 
mike 
0 Kudos
Message 1 of 15
(2,981 Views)
The property of a listbox is not an I32. The datatype of a listbox control is an I32 or an I32 array. To populate a listbox, you write a string array to the Item Names property.
0 Kudos
Message 2 of 15
(2,976 Views)

I have created a property node and write a string array to the item name property, but it seems not working, attached is the code.

Mike

0 Kudos
Message 3 of 15
(2,955 Views)

DO NOT wire a string to the Listbox. DO NOT wire anything to the Listbox unless you want to force a selection. DO NOT make the Listbox an indicator unless you don't want the ability to select anything from it. DO wire a string array with VALUES to the property node if you want to populate the Listbox and not an empty array like you have now.

Message Edited by Dennis Knutson on 08-08-2007 11:31 AM

0 Kudos
Message 4 of 15
(2,945 Views)

I see, thanks, but if i want to show the context of a text file in the list box, how can i do that with list box as a control?

Mike 

0 Kudos
Message 5 of 15
(2,934 Views)
It doesn't matter whether the listbox is a control or indicator as far as displaying whatever you want. It only matters if you want the user to select something or not.
0 Kudos
Message 6 of 15
(2,920 Views)
Is the item 1, item 2, item 3, the context of the file I need to import?  if it is not, how can i import a file to the listbox control, do you have an example?
Mike
0 Kudos
Message 7 of 15
(2,912 Views)
If you want to populate a Listbox, the example shows how the data must be formatted. There are numerous functions that do a file read. For example, Read From Spreadsheet will read a tab or comma delimited text file. It returns a 1D or 2D array. If there is a specific column in the file, you can index that column and write that to the property node. Why don't you post the type of file you want to read and the data you want to display. You might also just do a file read and write to a string indicator. A listbox is just one way to display information. I can't provide an example unless you explain exactly what it is you want to do.
0 Kudos
Message 8 of 15
(2,903 Views)
Attached is the data file, how can I read the first and second column in the list box?
Mike
0 Kudos
Message 9 of 15
(2,891 Views)
Read From Spreadsheet will do this (assuming you have 8.2). You then do an Index Array to get the columns you want as a 2D String array. A Multi-Column Listbox will load the values with a property node. If you use a Table, you can write the 2D string array directly to the terminal.
0 Kudos
Message 10 of 15
(2,882 Views)