Beispiel #1
0
 private void removeStockBttn_Click(object sender, EventArgs e)
 {
     if (stocksViewLbx.SelectedItems.Count != 0)
     {
         int id = Convert.ToInt32(stocksViewLbx.SelectedItems[0].Text);
         Stock.Remove(id);
         RefreshStocks();
     }
     else
     {
         MessageBox.Show("Please select a stock!");
         return;
     }
 }
Beispiel #2
0
 private void removeStockBttn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you really want to remove this stock?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (stocksViewLbx.SelectedItems.Count != 0)
         {
             int id = Convert.ToInt32(stocksViewLbx.SelectedItems[0].Text);
             Stock.Remove(id);
             RefreshStocks();
             MessageBox.Show("Item has been removed.");
         }
         else
         {
             MessageBox.Show("Please select a stock!");
             return;
         }
     }
 }