Remove Items From a CheckBox List
<p>Here is main form:</p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="CheckDelete.aspx.cs"  Inherits="CheckDelete" %&gt;

 &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org  /TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
  &lt;title&gt;&lt;/title&gt;
 &lt;/head&gt;
&lt;body&gt;
&lt;form id="form1" runat="server"&gt;
&lt;asp:CheckBoxList ID="chkItems" runat="server" style="width: 37px"&gt;
    &lt;asp:ListItem Value="A"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="B"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="C"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="D"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="E"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="F"&gt;&lt;/asp:ListItem&gt;
    &lt;asp:ListItem Value="H"&gt;&lt;/asp:ListItem&gt;
&lt;/asp:CheckBoxList&gt;
&lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Delete" /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/form&gt;
</code></pre>

<p>
</p>

<p>Code in Form:</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
    for (int i = 0; i &lt; chkItems.Items.Count; i++)
    {
        if (chkItems.Items[i].Selected == true)
        {
           chkItems.Items.RemoveAt(i);
        }
    }

}
</code></pre>

<p>In my form, I want to delete the items that the user has checked off. However, if I select 3 items, at least one item will remain on the form after the user hits delete. What am I missing?</p>
