取消
显示结果 
搜索替代 
您的意思是: 

text file + combobox

已解决!
转到解答

Hi guys,

I'm about to give up on this, I've searched all day about this and no one have the same thing that I want...

I have a txt file that is like this

 

Red red.png

Yellow yellow.png

Blue blue.png

...

N-Color ncolor.png

 

Using this file I want to create a combobox that its items and values have:

Items | Value

Red | red.png

Yellow | yellow.png

...etc

 

Right now I'm using Read text from File and Spreadsheet String to array but I can't figure out how to achieve this.

0 项奖励
1 条消息(共 10 条)
5,174 次查看

Post a VI of what you have tried so far.

 

0 项奖励
2 条消息(共 10 条)
5,163 次查看

here it is, is not very useful really...

下载全部
0 项奖励
3 条消息(共 10 条)
5,159 次查看
解答
接受人 lord_nox

You want to write to the Strings And Values property.  I also recommend using the Read Lines option on the Read Text File and then a FOR loop to parse each line (Match Pattern with a tab as the desired pattern).



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
4 条消息(共 10 条)
5,138 次查看

Thank you so much for the answer, I'll check it tomorrow in college and i'll answer, thanks again!

0 项奖励
5 条消息(共 10 条)
5,127 次查看

Hi Crossrulz, I'm making the VI that you send me and I have a little issue (I think)

Is with the array that goes to the bundle, here is the picture...

 

foro2.PNG

I create an Array Constant to the Index Array Input, can you please tell me what's wrong? thanks!

0 项奖励
6 条消息(共 10 条)
5,094 次查看

Hi nox,

 

create this array constant directly from your combobox "strings&values" property node!

(This way it will be a typedefinition as shown in Crossrulz' snippet! Btw. you need an array of cluster as is written in the context help of this property node…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
7 条消息(共 10 条)
5,091 次查看

By the way there is no need to recreate the VI.  The image CrossRulz has the VI embedded in it as a snippet.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US

0 项奖励
8 条消息(共 10 条)
5,079 次查看

@lord_nox wrote:

 

I create an Array Constant to the Index Array Input, can you please tell me what's wrong? thanks!


Right-click on the StringsAndValues[] input and select Create->Constant.  That will be the array of clusters you should be using.

 

As an aside, I always find Type Def of an array to be painful for a user.  The contents of the array should be the Type Def (in this case, the String/Value pair cluster), making things a lot more modular and easier to use.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
9 条消息(共 10 条)
5,077 次查看

Thanks to everyone, is working! 🙂

0 项奖励
10 条消息(共 10 条)
5,053 次查看