Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add string with List to a multiline textbox

I'm trying to add a list and a string in a textbox with this code

ilaninfotextbox.Text = string.Join(Environment.NewLine, ilantextinner, combinelist);

ilantextinner is a string and shows correctly on the textbox

ilantextinner is a List<string> with 20 lines in it

But ilantextinner list is showing like this in the textbox:

System.Collections.Generic.List`1[System.String]

How can I show the contents of ilantextinner in the textbox?

Note: If I use only ilantextinner contents are shown correctly.

like image 955
C.S. Avatar asked Sep 05 '25 03:09

C.S.


1 Answers

First, you need to Join the List, to make it a single string:

string joinedList = string.Join(Environment.NewLine, combinelist);

Then you join this string to the TextBox string:

ilaninfotextbox.Text = string.Join(Environment.NewLine, ilantextinner, joinedList);
like image 51
Felipe Deguchi Avatar answered Sep 07 '25 20:09

Felipe Deguchi