在列表框中看不到数组 [英] cannot see arrays in listbox
本文介绍了在列表框中看不到数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我将字符串数组"添加到列表框中时,我看不到数组的元素.我看到这行"String []数组".我只想查看列表框中的元素,因此我的代码非常基础;
字符串 [] playersName = 新 " player1", player2"};
listBox1.Items.Add(playersName);
解决方案
尝试:
字符串 [] playersName = 新 " player1", player2"}; listBox1.Items.AddRange(playersName);
使用字符串数组填充列表框控件 [ ^ ]
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;
string[] playersName = new string[] {"player1", "player2"};
listBox1.Items.Add(playersName);
what is wrong exactly?
解决方案
Try:
string[] playersName = new string[] {"player1", "player2"}; listBox1.Items.AddRange(playersName);
这篇关于在列表框中看不到数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文