我正在尝试ComboBox用另一个类中的数组的 PART填充 a 。我必须制作一个应用程序来创建客户、库存和订单。在订单表单上,我试图分别从客户和库存类中的数组中提取客户 ID 和库存 ID 信息。数组中有多种类型的信息:客户 ID、姓名、地址、状态、邮编等;库存 ID、名称、折扣值和价格。
这是我的阵列设置如下:
public static Customer[] myCustArray = new Customer[100];
public string customerID;
public string customerName;
public string customerAddress;
public string customerState;
public int customerZip;
public int customerAge;
public int totalOrdered;
Run Code Online (Sandbox Code Playgroud)
这就是我的组合框的设置方式:
public void custIDComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
custIDComboBox.Items.AddRange(Customer.myCustArray);
custIDComboBox.DataSource = Customer.getAllCustomers();
}
Run Code Online (Sandbox Code Playgroud)