如何使用字符串concat获取选定的列表框值? [英] how to get selected listbox value using string concat?
本文介绍了如何使用字符串concat获取选定的列表框值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们,
i知道这个小问题,但我需要你的想法,我搜索了很多网站已经但却找不到正确的方法,
i希望从列表框中获取选定的值,然后我想传递像字符串concat这样的值,(意味着我想转换一个字符串中的所有值)。
有人可以帮我帮忙,谢谢朋友们,:)
最好的问候
G .Renga
解决方案
看看这个:如何在Winforms中将Listbox值连接成字符串 [ ^ ]
< span class =code-comment> // linq查询以下所有选定项目
string required = listBox1.SelectedItems.Cast< string>()。Aggregate((a,b)=> a + b);
// linq查询以下所有不同的选定项目
string required = listBox1.SelectedItems.Cast< string>()。Distinct()。Aggregate((a,b)=> a + b);
Hi friends,
i know it's small issue, but i need your idea, i search many sites already but not able to find correct way,
i want to get selected values from listbox, then i want to pass that values like string concat,(means i want to convert all values in one string).
can anyone please help me to assist, thanks friends,:)
Best Regards
G.Renga
解决方案
Check this out: How to concat Listbox values into string in Winforms[^]
//Below linq query concat all the selected item string required =listBox1.SelectedItems.Cast<string>().Aggregate((a, b)=>a+b); //Below linq query concat all the distinct selected item string required =listBox1.SelectedItems.Cast<string>().Distinct().Aggregate((a, b)=>a+b);
这篇关于如何使用字符串concat获取选定的列表框值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文