public void Load_LB_GenericList()
{
List Team = new List();
ClassTeam CT = new ClassTeam(ClassTeam.playerType.Contract, "Sachin", 23, "33420242");
Team.Add(CT);
CT = new ClassTeam(ClassTeam.playerType.Contract, "Sourav", 23, "33420242");
Team.Add(CT);
CT = new ClassTeam(ClassTeam.playerType.Contract, "Dravid", 23, "33420242");
Team.Add(CT);
listBox1.DataSource = Team;
listBox1.DisplayMember = "Name";
listBox1.ValueMember = "Phone";
}
Wednesday, April 21, 2010
How to Add Generic List Items to ListBox in C# / VB.NET
We have already seen How to Add an ArrayList to ListBox. The following code shows how to add a C# Generic List to ListBox
Subscribe to:
Post Comments (Atom)
bind generic list to GridView C#
ReplyDelete