Add values of a function to listbox when click on checkbox?
<p>I have two checkboxes and one listbox. I assign functions to
both checkboxes. I want to add the items when I click on
checkboxes. I'm working on C#. I tried the following code.
It's working but overwrites the value when I click on
another check box.</p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{

    if (CheckBox1.Checked)
        pizza();

    if (CheckBox2.Checked)
        burger();
}

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
    if (CheckBox1.Checked == true)
        pizza();
}

protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
    if (CheckBox2.Checked)
        burger();
}
</code></pre>
