title: How to prevent SelectedIndexChanged event from firing in ListBox after removing an item from it
body: <p>I am working on selecting an item which will cause deletion of selected item. The problem is that when I delete an item I am selecting additional item which cause another deletion...</p>
  
  <p>How do I unselest/deselect after deleting selected item?</p>
  
  <p>This causes my problem:</p>
  
  <pre><code>    void lbMessage_SelectedIndexChanged(object sender, EventArgs e)
      {
          DialogResult result = new DialogResult();
  
          result = MessageBox.Show("Are you sure you want to remove this item?", "Removal Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  
          if (result == DialogResult.Yes)
          {
              lbMessage.Items.Remove(lbMessage.SelectedItem); 
              lbMessage.SelectedIndex = -1;
          }
          else
          {
          }
      }
  
      private void btnAddMessage_Click(object sender, EventArgs e)
      {
          lbMessage.Items.Add(txtMessage.Text);
          txtMessage.Text = string.Empty;
      }
  </code></pre>