gchq
Well-known member
- Joined
- Dec 14, 2007
- Messages
- 168
- Programming Experience
- 10+
Hi there
I need to find a method of looping through a listbox and retrieving the index number and values - quite straightforward in asp, but turning out to be something of a nightmare in winforms!
Here is the scenario - The user can add values in a textbox, that are in turn added to a DataTable that gives it a unique ID and a row number, this is then bound to the listbox.
The user can then move the items up or down the list by adjusting the row number in the datatable and rebinding to the listbox..
The problem that I am hitting is when the user needs to delete an item -the first part is easy - delete from the DataTable and rebind to the listbox. The bit where I hit the proverbial brick wall is needing to loop through the listbox rows and getting both the index number and the ValueMember - that way I can change the row numbers in the DataTable based on the index number against the ID number...
Any ideas?
Thanks
I need to find a method of looping through a listbox and retrieving the index number and values - quite straightforward in asp, but turning out to be something of a nightmare in winforms!
Here is the scenario - The user can add values in a textbox, that are in turn added to a DataTable that gives it a unique ID and a row number, this is then bound to the listbox.
The user can then move the items up or down the list by adjusting the row number in the datatable and rebinding to the listbox..
The problem that I am hitting is when the user needs to delete an item -the first part is easy - delete from the DataTable and rebind to the listbox. The bit where I hit the proverbial brick wall is needing to loop through the listbox rows and getting both the index number and the ValueMember - that way I can change the row numbers in the DataTable based on the index number against the ID number...
Any ideas?
Thanks