Environment:
.Net 2.0 SelfServicing
I have the following:
EmployeeCollection employees = new EmployeeCollection();
Now employees is bound to a BindingSource and BindingSource is bound to a customized NavigationBar component.
I am using the BindingSource MoveFirst(), MovePrevious(), etc. commands to move through the BindingSource and display the appropriate records (one at a time) in sequence.
Now employees can be deleted from EmployeeCollection(). I do this using
employees[index].Delete(). I have discovered that when I delete employees from the collection that the Count for the EmployeeCollection and also the BindingSource do not change.
When I move through the BindingSource I am always checking the current position against Count. When I hit the end I want to wrap back to the first record in the BindingSource.
My problem is that this logic does not easily work when the last records in the BindingSource are really deleted entities and they count as part of Count.
For example I have 5 employees in the employees collection. I delete employees 4 and 5 (the last two employees). Now I am at Position 2 (employee 3) in the BindingSource. Since I can't use Count to determine if I am at the end how do I easily determine that I have to wrap back to employee 1. I am interested to know the recommended practise for this scenario.
Thanks