How do I load a List<string> into a richTextBox and have each element on each line? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How do I load a List<string> into a richTextBox and have each element on each line?

Loading Generic List into richTextBox

4th Dec 2016, 4:01 PM
Rocco
Rocco - avatar
2 Respostas
+ 2
Use the string builder. StringBuilder b =new StringBuilder(); foreach(var item as list) {b.Append(item); b.AppendLine(); } string output =b.ToString();
4th Dec 2016, 5:36 PM
Omer Nahum
Omer Nahum - avatar
0
Iterate the list (forEach) and add each item into the textbox with appended "\n" to end.
4th Dec 2016, 4:48 PM
Ondřej Doněk
Ondřej Doněk - avatar