build and assign an array to a combo box

  • Thread starter Thread starter Jeff Williams
  • Start date Start date
J

Jeff Williams

How di I dynamically build and 2 dimensional array and assign this array
to a combobox. 1 item will be the displayed details and the other is
the value I need returned.
 
You can add any object to a listbox, even classes. For example:

class Product
{
private int ProductID;
private string ProductName;

public Product(int productid, string productname)
{
this.ProductID = productid;
this.ProductName = productname;
}
}

Product myProduct = new Product(5343, "Car");

ListBox.Items.Add(myProduct);

Product selectedProduct = ListBox.SelectedItem() as Product;

hope you find it useful
 
Back
Top