I have some static collections that I load at startup:
Code:
CallTypes = New BusinessObjects.CallTypeCollection
CallTypes.es.Connection.Name = "SQLCLP"
CallTypes.LoadAll()
I then have a form with a combobox where i bind the combo to the collection:
Code:
Me.uxCallTypes.DataSource = Nothing
Me.uxCallTypes.DataSource = CallTypes
Me.uxCallTypes.DisplayMember = BusinessObjects.CallTypeMetadata.ColumnNames.Calltype
Me.uxCallTypes.ValueMember = BusinessObjects.CallTypeMetadata.ColumnNames.CallTypeID
Me.uxCallTypes.SelectedIndex = -1
and i have this databinding:
Code:
Me.uxCallTypes.DataBindings.Add(New Binding("SelectedValue", entity, BusinessObjects.CallRequestMetadata.PropertyNames.CallTypeID, True, DataSourceUpdateMode.OnPropertyChanged))
The problem i have is that i can have multiple copies of the same form open at once,
so whichever value is selected in the most recently changed form is then selected for
all other instances of the form since they are using the same datasource.
I know i can create a collection local to each form instance, but don't want to have to incur
the overhead of loading it each and every time.
How can i accomplish different selected values on different instances of a form?