System.Collections.ArrayList al = new System.Collections.ArrayList();
for(int i=0; i<5; i++){
DataClass dc = new DataClass();
dc.ID = i;
dc.Description = "Collection Item " + i;
al.Add(dc);
}
this.ListBox1.DataSource = al;
this.ListBox1.DataTextField = "Description";
this.ListBox1.DataValueField = "ID";
this.ListBox1.DataBind();
class DataClass{
public string Description{
get{return description;}
set{description = value;}
}
public int ID{
get{return id;}
set{id = value;}
}
private string description;
private int id;
}