Click here to Skip to main content
15,905,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i add "string array" into listbox, i cant see the elements of the array. I see this line "String[] Array". i just want to see the elements in listbox so my code is very basic;

C#
string[] playersName = new string[] {"player1", "player2"};
listBox1.Items.Add(playersName);


what is wrong exactly?
Posted
Updated 24-Jan-12 3:54am
v2

1 solution

Try:

C#
string[] playersName = new string[] {"player1", "player2"};

listBox1.Items.AddRange(playersName);



Populating a ListBox Control with an Array of Strings[^]
 
Share this answer
 
Comments
fjdiewornncalwe 24-Jan-12 9:55am    
+5. Exactly.
Member 8592678 24-Jan-12 9:56am    
it worked, thanks :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900