I have a listbox, lstTemplates, that is bound to the DataSet dsBatches. The ListBox must at all times have an item selected in order for the other
procedures in the form to work. The ListBox DisplayMember is "TemplateID".
However, if I change the value of TemplateID in the DataSet, then the ListBox loses it´s selection (lstTemplates.SelectedIndex = -1).
Dim i as Integer= lstTemplates.SelectedIndex
dsTemplates.Templates.Rows(i)("TemplateID") = txtTemplate.Text 'This line sets the selected index to -1
How can I update the DataSet without losing the selected item in my ListBox? Any suggestions?
Any assistance would be mostly appreciated!