ComboBox.DataSource .Net v1.1.4322: Problem to assign new datasource

  • Thread starter Thread starter Stephan
  • Start date Start date
S

Stephan

Hello,

I have set the datasource property of a combobox control to an own
type which iherits from CollectionBase.
The first time the assignment works fine but when I try to reassign an
updated version my Collection to the datasource, the datasource
remains unassigned.
With the former framework version it worked fine but with 1.1.4322 the
reassignment is not working.

Does anybody know what the reason for this behavior is?

Thanks for your help in advance,

best wishes,
Stephan

Code Excerpt:

BatchEntries batchEntries = mQueue.Entries;
this.cmbEntries.DataSource=null;

if (batchEntries.Count>0)
{

this.cmbEntries.DataSource=batchEntries;
this.cmbEntries.DisplayMember="DisplayName";

}
 
Well,
I thought I have bind it and it works for the first time of binding.
I want to bind simply a collection of MessageQueue entries to a
combobox field.
For this I have created a Class which inherits from CollectionBase and
which holds all the current MessageQueue entries. I get this
collection via remoting from the server. The collection is filled
properly.
Now I want regulary update the comboBox with the latest MQEntries, so
I get a new collection object and bind it to the DataSource of the
comboBox.
That's what my Bind() function should do. The first time it work the
second time,
the assignment: this.cmbEntries.DataSource=batchEntries;
does not work.´
Besides, I use SingleCall objects as my remoting strategy.

My Bind() Function:
private void Bind()
{

IEAdpc.ApplicationFramework.BatchQueue.Client.BatchQueue mQueue=new
IEAdpc.ApplicationFramework.BatchQueue.Client.BatchQueue();
BatchEntryInfo bi=new BatchEntryInfo();
bi.SetDisplayName("<none>");

//dummy object
BatchEntries batchEntries = mQueue.Entries;
batchEntries.Add(bi);

this.cmbEntries.DataSource=null;
if (batchEntries.Count>0)
{

this.cmbEntries.DataSource=batchEntries;
this.cmbEntries.DisplayMember="DisplayName";
this.cmbEntries.SelectedItem=bi;

}




}
 
I got the reason why!

The sort property is set by default to true. When I change this to
false the rebinding to a new updated datasource works properly.


thanks for your patience and help.
Stephan
 
Back
Top