Strange Behaviour

Cricket

Active member
Joined
Jan 6, 2005
Messages
28
Location
Hamilton, ON, Canada
Programming Experience
5-10
I've written a sub that refreshes the contents of a ComboBox when you select an item from another ComboBox.

It kinda works perfect, every second time however it doesn't work! This makes no sense since it calls the exact same sub. Now here is the strange part. If I comment out the Clear method it will Fill the other ComboBox as expected, however it will have double the items due to not clearing it first. This means the refesh is working, but the Clear method is somehow getting called after the Fill method.

Has anyone seen this? Is my code doing something that I'm unaware of?

PrivateSub cboSeries_SelectedValueChanged(ByVal sender AsObject, ByVal e As System.EventArgs) Handles cboSeries.SelectedValueChanged
Me.ocSelectSeriesModel.Parameters("@fuid_Series").Value = Me.cboSeries.SelectedValue
Me.daProposal.SelectCommand = Me.ocSelectSeriesModel
Me.dtSeriesModel.Clear()
Me.daProposal.Fill(Me.dtSeriesModel)
EndSub
 
Last edited:
I think you need to learn KISS (Keep It Simple Stupid). Although maybe I'm not one to talk.. :)
 
You could also use a dataview as the dataSource of the second combo and set the RowFilter based on the slection of the first combo. This would save trips to the dataStore as you would only have to fill a dataTable once then simply filter it.
 
Back
Top