title: sorted combo box and reassigning the datasource
body: <p><strong>Background:</strong>
  There are two combo boxes that differ only in the Sorted property.  comboBox1 has the Sorted property set to <em>true</em> and comboBox2 has the Sorted property set to <em>false</em>.  When attempting to reassign/reset the datasource property of these two combo boxes, comboBox1 displays no data and comboBox2 does.  Why does the Sorted property prevent comboBox1 from displaying its' data properly?</p>
  
  <p>All code included below:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      private string[] a8BitGames = { "Metroid", "Zelda", "Phantasy Star", "SB:S&amp;SEP" };
      private string[] a16BitGames = { "StarFox", "Link", "Final Fantasy", "Altered Beast" };
      private List&lt;string&gt; lSomeList = null;
      private List&lt;string&gt; lSomeOtherList = null;
  
      public Form1()
      {
          InitializeComponent();
          this.lSomeList = new List&lt;string&gt;(a8BitGames);
          this.lSomeOtherList = new List&lt;string&gt;(a16BitGames);
          this.comboBox1.DataSource = lSomeList;
          this.comboBox2.DataSource = lSomeOtherList;
      }
  
      private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
          this.IndexChanged(1);
      }
  
      private void IndexChanged(int comboBox)
      {
          this.comboBox1.DataSource = null;
          this.comboBox1.DataSource = a16BitGames;
  
          this.comboBox2.DataSource = null;
          this.comboBox2.DataSource = a8BitGames;
      }
  
      private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
      {
          this.IndexChanged(2);
      }
  }
  
  partial class Form1
  {
      /// &lt;summary&gt;
      /// Required designer variable.
      /// &lt;/summary&gt;
      private System.ComponentModel.IContainer components = null;
  
      /// &lt;summary&gt;
      /// Clean up any resources being used.
      /// &lt;/summary&gt;
      /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
      protected override void Dispose(bool disposing)
      {
          if (disposing &amp;&amp; (components != null))
          {
              components.Dispose();
          }
          base.Dispose(disposing);
      }
  
      #region Windows Form Designer generated code
  
      /// &lt;summary&gt;
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// &lt;/summary&gt;
      private void InitializeComponent()
      {
          this.comboBox1 = new System.Windows.Forms.ComboBox();
          this.comboBox2 = new System.Windows.Forms.ComboBox();
          this.SuspendLayout();
          // 
          // comboBox1
          // 
          this.comboBox1.FormattingEnabled = true;
          this.comboBox1.Location = new System.Drawing.Point(13, 13);
          this.comboBox1.Name = "comboBox1";
          this.comboBox1.Size = new System.Drawing.Size(121, 21);
          this.comboBox1.Sorted = true;
          this.comboBox1.TabIndex = 0;
          this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
          // 
          // comboBox2
          // 
          this.comboBox2.FormattingEnabled = true;
          this.comboBox2.Location = new System.Drawing.Point(13, 41);
          this.comboBox2.Name = "comboBox2";
          this.comboBox2.Size = new System.Drawing.Size(121, 21);
          this.comboBox2.TabIndex = 1;
          this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
          // 
          // Form1
          // 
          this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
          this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
          this.ClientSize = new System.Drawing.Size(284, 262);
          this.Controls.Add(this.comboBox2);
          this.Controls.Add(this.comboBox1);
          this.Name = "Form1";
          this.Text = "Form1";
          this.ResumeLayout(false);
  
      }
  
      #endregion
  
      private System.Windows.Forms.ComboBox comboBox1;
      private System.Windows.Forms.ComboBox comboBox2;
  }
  </code></pre>