Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Items to Listbox
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Adding Items to Listbox
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01026697
Message ID:
01026697
Vues:
55
Hi

Could anybody give me some 'best practice' guidelines when adding items to listboxes?

I need to add a series of values to a listbox , say employee names and the employees id

The Employee name would be the displaymember and the employee Id would be the valuemember.

In the listbox I would like to display the name but behind the scenes store the id so that when the user clicks on an employee in the list box I can work out what the ID is for the selected employee.

I'm not using a datatable or an array at the moment, but need to add a series of values from an external com component.

so my code looks something like this ;
EmployeesClass oEmps = new EmployeesClass();

int lnRetValue = 0

lnRetValue = oEmps.first()
while(lnRetValue != -2)
{
    cEmpName = oEmps.GetEmpName()
    iEmpID   = oEmps.GetEmpId()
    
    * need to populate the list box items here...

    lnRetValue = oEmps.next() - this will return -2 when we hit the last record.

}
Anybody got any pointers for me?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform