title: How to change the Combobox.Text property when Combobox is bound to data?
body: <p>My scenerio is like this:</p>
  
  <p>At runtime, I bind ToolStripComboBox to array of struct:</p>
  
  <pre><code>cbxTimes.ComboBox.DataSource = PlayTimeLengths;
  cbxTimes.ComboBox.DisplayMember = "Description";
  cbxTimes.ComboBox.ValueMember = "Minutes";
  </code></pre>
  
  <p>The <code>DropDownStyle</code> of <code>ToolStripCombobox</code> is set to <code>DropDown</code>.</p>
  
  <p>Everything is working fine, I can select values from the dropdown list and I can write text in the control.</p>
  
  <p>However I wanted to prevent user from pressing some controls and alternate the Text property when some other controls are pressed.</p>
  
  <p>I am trying to accomplish this in <code>KeyPress</code> event:</p>
  
  <pre><code>private void cbxTimes_KeyPress(object sender, KeyPressEventArgs e)
  {
      var cbxSender = ((ToolStripComboBox)sender).ComboBox;
      string S = cbxSender.Text;
      //some operations on the S variable
      cbxSender.Text = S;
      e.Handled = true;
  } // breakpoint here shows that cbxSender.Text is not changed to S!
  </code></pre>
  
  <p>So the Text property has not been changed but I didn't get any exception.
  However, if I run the program further (I quit from the debugging) I see that the Text property is changed - to be more specific. I see the text from S inside the control.</p>
  
  <p>Now, imagine that I press any key for the second time, and again I am in the debugger in the same event:</p>
  
  <pre><code>private void cbxTimes_KeyPress(object sender, KeyPressEventArgs e)
  {
      var cbxSender = ((ToolStripComboBox)sender).ComboBox;
      string S = cbxSender.Text; // this time breakpoint is here
      //some operations on the S variable
      cbxSender.Text = S;
      e.Handled = true;
  } // breakpoint here shows that cbxSender.Text is not changed to S!
  </code></pre>
  
  <p>But this time I put breakpoint on the second line and after examining the Text property I see that it still has not changed. Despite the fact that I've altered it on the first time when the event was fired up and the altereted text is visible in the control. But under debugger I see different value, I see value that has been set up at the begining. Value which belongs to the array of structs.</p>
  
  <p>SO what can I do to overcome this problem?</p>