将列表框内容复制到字符串 [英] Copying listbox contents to a string

查看:98
本文介绍了将列表框内容复制到字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个充满电子邮件地址的列表框,我正在尝试将它们编译成一个格式为hello@hello.com; goodbye@goodbye.com的字符串。我考虑将它们复制到数组然后循环它们直到字符串包含每封电子邮件但是也无法执行此操作。



如果有人能为我提供解决方案我将非常感激!

I have a listbox full of email addresses and am trying to compile them into one string with the format of "hello@hello.com; goodbye@goodbye.com". I considered copying them to an array and then looping them until the string contains every email but have been unable to do this also.

If anyone can provide a solution for me I would be very grateful!

推荐答案

尝试:

Try:
string s = String.Join("; ", myListBox.Items.Cast<string>());


这篇关于将列表框内容复制到字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆