Jump to content
Sign in to follow this  
MViControl

how to use multi list box to display contents in a 2D variant array

Recommended Posts

Hi all,

When I use NI data connectivity toolkit to search database , I plan to use a multi list box (as a table) to display the seach database results, but I found the default output of the earch is a 2D variant array. How can I display the contents in a multi list box?

Thanks

Share this post


Link to post
Share on other sites

The variant can be coerced to a string, or other data type if known. Data types can be pulled from the database if absolutely required.

  • Like 1

Share this post


Link to post
Share on other sites

Hi all,

When I use NI data connectivity toolkit to search database , I plan to use a multi list box (as a table) to display the seach database results, but I found the default output of the earch is a 2D variant array. How can I display the contents in a multi list box?

Thanks

You can convert variant to string and display the result in the MCL.

I have a small utility VI to help...

2D Variant to MCL.zip

  • Like 1

Share this post


Link to post
Share on other sites

If you have a valid connection reference, use the DB Toolkit vi located at:

vi.lib\addons\database\Auxilliary.llb\DB Tools Select All Data.vi

This vi returns a 2D array of string that you can write to the ItemNames property of a MCL or the Values of a table control.

If you have a recordset reference, you can use the sub-vi inside the one above called

vi.lib\addons\database\Auxilliary.llb\DB Tools Fetch Table Data.vi

No special coding or libraries required. You can use the VIs NI gives you (they are not on the palette though ;))

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.