如何Listbox
在 C# 中使用 Form 的构造函数从数组中填充数据?到目前为止,这就是我在 Name Class 中所拥有的
String[,] strSpecialCakeName = {
{"Holiday Cake at", "$18"},
{"Birthday Cake at", "$25"},
{"Wedding Cake at", "$40"},
{"Super Hero Cake at", "$30"}
};
这就是我的表格
public partial class frmLabSeven : Form
{
private string[,] strSpecialCakeName = new string[4, 2];
public frmLabSeven()
{
InitializeComponent();
strSpecialCakeName [0, 0] = "Holiday Cake at $18";
strSpecialCakeName [1, 1] = "Birthday Cake at $25";
strSpecialCakeName [2, 2] = "Wedding Cake at $40";
strSpecialCakeName [3, 3] = "Super Hero Cake at $30";
}
}
我知道我可以在表单上直接使用 Collection in Item,但这不是我想要做的。我只是不知道如何使用数组让数据显示在列表框中。