[RESOLVED] [2005] Only updating first record
I've got a ListView which is populated by a DataTable obtained from an XML data source.
The application is being designed to allow the user to scroll through a list of items in the ListView, and display data in three TextBoxes that correspond with the selected item.
Scrolling through the ListView and displaying the correct data in the TextBoxes is fine, however, I want the user to be able to edit the text boxes, press Save, and update the correct record.
What I'm finding is that it ALWAYS updates the data associated with the first item in the ListView when it writes the data back to the XML file.
Could anybody tell me what am I missing?
Re: [2005] Only updating first record
What is your code to do the update?
Re: [2005] Only updating first record
You really should be using a DataGridView rather than a ListView. You could bind the DataTable to a BindingSource and the BindingSource to both the grid and the TextBoxes. There would be no code and you'd be guaranteed of updating the correct record. You could even do away with the TextBoxes and let the user edit the data in the grid itself.
Re: [2005] Only updating first record
DataGridView works much better - thanks for the suggestion.
Re: [RESOLVED] [2005] Only updating first record
I used to use ListViews in .NET 1.1 because I thought the DataGrid didn't fit with the rest of the UI. The DataGridView sure is easier to use than either the DataGrid or the ListView and it has a modern look that goes with the other standard controls.