Skip to content

Instantly share code, notes, and snippets.

@sephto
Created May 20, 2013 20:27
Show Gist options
  • Save sephto/5615236 to your computer and use it in GitHub Desktop.
Save sephto/5615236 to your computer and use it in GitHub Desktop.
private void button4_Click(object sender, EventArgs e)
{
while (lbCost.SelectedItems.Count > 0)
{
indexList.Add(lbCost.SelectedIndices[0]);
lbCost.Items.Remove(lbCost.SelectedItems[0]);
}
for (int i = 0; i < indexList.Count; i++ )
{
totalCost -= Convert.ToDouble(shopList[Convert.ToInt32(indexList[i].ToString())].ToString());
shopList.RemoveAt(Convert.ToInt32(indexList[i].ToString()));
indexList.RemoveAt(i);
}
lblTotal.Text = Convert.ToString(totalCost.ToString("C"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment