【发布时间】:2018-08-01 22:39:25
【问题描述】:
如何预加载(form1_load)并在数组中显示名称列表或加载到列表中然后显示?
这是我得到的:
private void Form1_Load(object sender, EventArgs e) {
Random rand = new Random();
int index = 0;
string[] names = new string[] {
"Josh",
"Waylon",
"Alan",
"Jack",
"John",
"elaine",
"Monica",
"Kaithe",
"Kim",
"Jazy"
};
////preload the boxlist with 10 boxes
for (int i = 1; i <= 10; i++) {
int accountNumber = rand.Next(0, 10);
decimal accountBalance = rand.Next(0, 10);
string accountName = names[];
Account account = new Account(accountNumber, accountBalance, accountName);
//save the box in the boxlist
accountList.Add(account);
}
【问题讨论】:
-
预加载是什么意思?您想在哪个控件中显示名称?在
ListBox中? 没有盒子列表
标签: c# winforms class display preload