I got a List that I add to every time I create a new Employee.
The content of this list is then displayed in a Listbox. The problem is that each time
I add a new Employee and then call the below method the items in the listbox gets duplicated over and over again. So if I got 3 items in the list the Listbox displays 6.
I have checked with employeeList.Count and I am sure about the amount of items in the list.
What is wrong?
public void UpdateEmployeeList()
{
foreach (Employees values in employeeRegistry.employeerList)
{
lstResults.Items.Add(values);
}
}
Thankful for all help!
Have you Clear your listbox before adding new employees ?