Okay guys,
I have a list box that is bound to a datatable. I have multiple queries set for the tableadapter and when the user selects a specific item from a listbox on another form, this form will open and offer selections from the datatable in the listbox. I have a subroutine set to check each time one of these specific items are selected so it will load the corresponding data into the listbox on the form that appears.
The problem occurs when that subroutine is called to load the new data into the datatable. I get an OutOfRange error, stating that there is no row at -1. What's worse is that after the error occurs, I can step into it and the data loads correctly!
I assume this error is thrown because I have cleared the datatable bound to the listbox, however, if I unbind the datasource from the listbox, I receive the same error only the data does not load into the listbox.Code:Public Sub Reset() Me.OCCIDDataSet.Skills_List.Clear() Start() SkillExtraSelect.Refresh() End Sub
What is this error referring to? Is it the listbox data or is something else being called out? It doesn't affect how the program runs, it's just annoying and I hate to have errors.Code:Public Sub Reset() Me.SkillExtraSelect.DataSource = Nothing Me.OCCIDDataSet.Skills_List.Clear() Start() Me.SkillsListBindingSource.DataSource = OCCIDDataSet.Skills_List SkillExtraSelect.DataSource = SkillsListBindingSource SkillExtraSelect.Refresh() End Sub




Reply With Quote
