views:

87

answers:

3

I have a combo box bound to a Data Source (clientInfoBindingSource) for its selected item and text, I am using a auto generated Binding Navigator on a different Data Source (totalsBindingSource) and on

this.totalsBindingSource.CurrentChanged += new System.EventHandler(this.updateClientInfo);

it should update the current object for client info binding source.

private void updateClientInfo(object sender, EventArgs e)
{
    clientInfoBindingSource.Position = clientInfoBindingSource.Find("ClientID",ClientIDTextBox.Text);
}

On the last item in the list it is updating all of my text boxes correctly but the drop down software box will be blank.

Here is the autogenerated code for the combobox

// 
// softwareComboBox
// 
this.softwareComboBox.DataBindings.Add(new System.Windows.Forms.Binding("SelectedItem", this.clientInfoBindingSource, "Software", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.softwareComboBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientInfoBindingSource, "Software", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.softwareComboBox.FormattingEnabled = true;
this.softwareComboBox.Location = new System.Drawing.Point(106, 234);
this.softwareComboBox.Name = "softwareComboBox";
this.softwareComboBox.Size = new System.Drawing.Size(220, 21);
this.softwareComboBox.TabIndex = 23;

Any pointers in the right direction. This datasource is bound to a Dataset which was auto-genrated from a SQL server.

To fill the drop down on load of the main form i do

this.clientSoftwareTableAdapter.Fill(this.clientsDataSet.ClientSoftware);
softwareComboBox.Items.AddRange(this.clientscDataSet.ClientSoftware.Select(a => a.Software).ToArray());

EDIT -- Changed the above code to use DataSourceUpdateMode.OnPropertyChanged but it did not affect the behavior.

+1  A: 

At a glance: I would try setting the DataSourceUpdateMode to OnPropertyChanged

STW
Changing it did not work. any other ideas?
Scott Chamberlain
I'll have to play around with reproducing the problem. You wouldn't have a runnable example that displays the issue, by chance?
STW
Do you have a email address to give you some chunks of the source? I do not want to post it publicly.
Scott Chamberlain
A: 

I have conceded defeat and will just change the combo box to a text box, making this answer to check it off.

Scott Chamberlain
A: 

I don't know if the question is still valid, but have you tried:

softwareComboBox.DataSource = this.clientsDataSet.
                                      ClientSoftware.
                                         Select(a => a.Software).ToArray();

instead of adding the items manually?

Paulo Santos