R
Robert Bravery
Hi ALl,
I want to create a a generic method to add list items.
At different parts of the app, I will pass it either a listbox control or a
dropdownlist control
then the method will have generic code to add new list items
No I have a lot of loops in adding theses list items, so I don;t really want
to duplicate that code
for eg.
if (comp.IndividualShareholderCollection != null)
{
foreach (IndividualShareholder share in
comp.IndividualShareholderCollection)
{
List.Items.Add(share.ShareholderName);
}
}
if (comp.CompanyShareholderCollection != null)
{
foreach (CompanyShareholder CompShare in
comp.CompanyShareholderCollection)
{
List.Items.Add(CompShare.ShareholderName);
}
}
.....
......
......
Thanks
Robert
I want to create a a generic method to add list items.
At different parts of the app, I will pass it either a listbox control or a
dropdownlist control
then the method will have generic code to add new list items
No I have a lot of loops in adding theses list items, so I don;t really want
to duplicate that code
for eg.
if (comp.IndividualShareholderCollection != null)
{
foreach (IndividualShareholder share in
comp.IndividualShareholderCollection)
{
List.Items.Add(share.ShareholderName);
}
}
if (comp.CompanyShareholderCollection != null)
{
foreach (CompanyShareholder CompShare in
comp.CompanyShareholderCollection)
{
List.Items.Add(CompShare.ShareholderName);
}
}
.....
......
......
Thanks
Robert