Windows Form application
-
Thursday, September 13, 2012 6:47 AMHow to print all selected item in list box to textbox in multisimple selection mode in visual c++?
- Edited by i.sankar Thursday, September 13, 2012 8:56 AM
All Replies
-
Thursday, September 13, 2012 7:23 AM
Dim obj As Object
For Each obj In ListBox1.SelectedItems
TextBox1.Text &= obj.ToString
NextWhere ListBox1 is MultiSimple List Box
and TextBox1 is the TextBox
Regards,
ManjunathRV
-
Tuesday, September 18, 2012 6:50 AMModerator
Hi i.sankar,
This is the code snippet written in C++:
You can directly use += operator in for each, in statement to get all the selected items.
textBox1->Text = ""; for each(Object^ o in listBox1->SelectedItems) { textBox1->Text += o->ToString() + " "; }I prefer to use StringBuilder because it is more efficient. You have to using System::Text namespace.
using namespace System::Text;
StringBuilder^ sb = gcnew StringBuilder(); for each(Object^ o in listBox1->SelectedItems) { sb->Append(o->ToString())->Append(" "); } textBox1->Text = sb->ToString();
Best regards,Chester Hong
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked As Answer by i.sankar Saturday, September 22, 2012 8:11 AM


