title: ComboBox data binding
body: <p>I have a combobox control on form that pull its data (Displays and values) from some datasource. On another side I have table with one row. I want when app is lauching, combobox set selectedvalue or selecteditem to value of one column in above row. And when user has changed combobox it will persist change to row. I have tried to bind SelectedValue to this column, but it doesn't work. Combobox just sets on start to first item. What is problem?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is a Win Forms project.
  Here is the binding code:</p>
  
  <pre><code>this.comboBoxCountries = new System.Windows.Forms.ComboBox();
  this.countriesBindingSource = new System.Windows.Forms.BindingSource(this.components);
  
  // 
  // comboBoxCountries
  // 
  this.comboBoxCountries.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.searchCriteriaBindingSource, "Postcode", true));
  this.comboBoxCountries.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.searchCriteriaBindingSource, "CountryCode", true));
  this.comboBoxCountries.DataSource = this.countriesBindingSource;
  this.comboBoxCountries.DisplayMember = "Name";
  this.comboBoxCountries.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  this.comboBoxCountries.FormattingEnabled = true;
  this.comboBoxCountries.Location = new System.Drawing.Point(190, 19);
  this.comboBoxCountries.Name = "comboBoxCountries";
  this.comboBoxCountries.Size = new System.Drawing.Size(156, 21);
  this.comboBoxCountries.TabIndex = 2;
  this.comboBoxCountries.ValueMember = "Code";
  this.comboBoxCountries.SelectedValueChanged += new System.EventHandler(this.comboBoxCountries_SelectedValueChanged);
  
  // 
  // countriesBindingSource
  // 
  this.countriesBindingSource.DataMember = "Countries";
  this.countriesBindingSource.DataSource = this.dbDataSetCountries;
  // 
  // dbDataSetCountries
  // 
  this.dbDataSetCountries.DataSetName = "dbDataSetCountries";
  this.dbDataSetCountries.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
  
  // 
  // searchCriteriaBindingSource
  // 
  this.searchCriteriaBindingSource.AllowNew = false;
  this.searchCriteriaBindingSource.DataMember = "SearchCriteria";
  this.searchCriteriaBindingSource.DataSource = this.dbDataSetSearchCriteria;
  this.searchCriteriaBindingSource.BindingComplete += new System.Windows.Forms.BindingCompleteEventHandler(this.searchCriteriaBindingSource_BindingComplete);
  // 
  // dbDataSetSearchCriteria
  // 
  this.dbDataSetSearchCriteria.DataSetName = "dbDataSetSearchCriteria";
  this.dbDataSetSearchCriteria.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT2</strong></p>
  
  <p>As I have mentioned in my comment below, I have another <code>textbox</code> that is binded to another <code>DataMember</code> of same binding source and <code>textbox</code> working fine. It's appear with appropriate value. When I change <code>DataMember</code> on same datamember on which I set <code>selectedvalue</code> property of combobox binding it's also show a good result and work properly.</p>
  
  <p>Thanks in advance!</p>