So I have not generated the event for the picturebox but lets say the picture box is "private void pictureBox2_BeverageItems" followed by curly bracelts . I have been looking all over and couldnt find a correct implementation my guess is to probably use "streamreader" but im still fairly new to that.....
thanks guys
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace SamsonPizza
{
public partial class Form1 : Form
{
public decimal[] beveragePrice = new
//array is positional, water is 2.50, you index in it to get price
decimal[] { 1.75m, 1.75m, 1.75m, 1.75m, 2.50m };
decimal beverageTotal = 0;
public decimal[] specialtyItemsPrice = new
// array is positional. 'small horse' is last
decimal[] { 5.50m, 6.50m, 8.00m, 3500m };
decimal specialtyTotal = 0;
public decimal[] pizzapiePrice = new
// array is positional. used as in indexed
decimal[] { 10m, 15.50m, 20m };
public Form1()
{
InitializeComponent();
} // end of Form 1
//whenever selected value of pizza size is changed,
//this event is executed
private void comboBoxSize_SelectedValueChanged(object sender, EventArgs e)
{
// display currently selected item in the combobox
label4.Text = comboBoxSize.SelectedItem.ToString();
// if else sets price box based upon the indes selected
// we know that first is small at indes 0,
// next is medium at index 1
// then last is large at index 2
if (comboBoxSize.SelectedIndex == 0)
label5.Text = pizzapiePrice[comboBoxSize.SelectedIndex].ToString("0.00");
else if (comboBoxSize.SelectedIndex == 1)
label5.Text = pizzapiePrice[comboBoxSize.SelectedIndex].ToString("0.00");
else if (comboBoxSize.SelectedIndex == 2)
label5.Text = pizzapiePrice[comboBoxSize.SelectedIndex].ToString("0.00");
} // end of comboBoxsize_SelectedItem
//whenever selected value of crust is changed,
//this event is executed
private void comboBoxCrust_SelectedValueChanged(object sender, EventArgs e)
{
label6.Text = comboBoxCrust.SelectedItem.ToString();
} // end of comboBoxCrust_SelectedValueChanged
//Toppings
private void checkedListBoxPizzaItems_SelectedValueChanged(object sender, EventArgs e)
{
label7.Text = ""; // reset display
//show the object title for each item selected
foreach (object itemChecked in checkedListBoxPizzaItems.CheckedItems)
{
// keep adding by += and place it in the label
label7.Text += itemChecked.ToString() + " " ;
}
} // end of checkedListBoxPizzaItems
//Beverage -- entered everytime a beverage is selected
//or clicked in beverages
private void checkedListBoxBeverage_SelectedValueChanged(object sender, EventArgs e)
{
// reset display & show the object title for each item selected
label9.Text = ""; //remove beverage text from display order labels
beverageTotal = 0; //remove beverage price from display order labels
//will go through each item checked based
//upon checkedListBoxBeverage's CheckedItems
foreach (object itemChecked in checkedListBoxBeverage.CheckedItems)
{
// keep adding checked items to the label to show text
label9.Text += itemChecked.ToString() + " ";
// index of item checked is passed to the price array
// += keeps totaling
beverageTotal += beveragePrice[checkedListBoxBeverage.Items.IndexOf(itemChecked)];
// convert to string and display
label12.Text = beverageTotal.ToString("0.00");
} // end of Foreach
} // end of checkedListBoxBeverage
//Specialty -- entered everytime a check is selected
// or clicked in specialty items
private void checkedListBoxSpecialty_SelectedValueChanged(object sender, EventArgs e)
{
// reset display & show the specialty
// object title for each item selected
label14.Text = ""; //remove specialty text from display order labels
specialtyTotal = 0; //remove specialty price from display order totals
// keeps executing for checked items
//will go through each item checked based
//upon checkedListBoxSpecialty's CheckedItems
foreach (object itemChecked in checkedListBoxSpecialty.CheckedItems)
{
// keep adding checked items to the label to show text
label14.Text += itemChecked.ToString() + " ";
// index of item checked is passed to the price array
// += keeps totaling
specialtyTotal += specialtyItemsPrice[checkedListBoxSpecialty.Items.IndexOf(itemChecked)];
label15.Text = specialtyTotal.ToString("0.00"); // convert to string and display
} // end of Foreach
} // end of checkedListBoxSpecialty
// buttons below. first is place order then all clear buttons
//
//Place Order here
// when this button is pressed, a simple total of
//pizza, beverage and specialty subtotals is performed
// button click event is triggered
private void buttonPlaceOrder_Click(object sender, EventArgs e)
{
// zero out previous values
label17.Text = "";
// pre-zero if empty to show no order
if (label5.Text == "") label5.Text = "0.00";
if (label12.Text == "") label12.Text = "0.00";
if (label15.Text == "") label15.Text = "0.00";
label17.Text = (decimal.Parse(label5.Text) + decimal.Parse(label12.Text) +
//parse the decimal, add them and convert back to string
decimal.Parse(label15.Text)).ToString("0.00");
} // end of buttonPlaceOrder
// all clear buttons follow
// button click events are triggered
private void buttonClearToppings_Click(object sender, EventArgs e)
{
// uncheck all. Reset Toppings display
label7.Text = "";
for (int i = 0; i < checkedListBoxPizzaItems.Items.Count; ++i)
// set SetItemChecked property to false from true.
// it gets set to true when use checks it
checkedListBoxPizzaItems.SetItemChecked(i, false);
} // end of buttonClearToppings
private void buttonClearBeverage_Click(object sender, EventArgs e)
{
// uncheck all. Reset Beverage display
label9.Text = "";
// Reset beverage sub total box. the order total simply adds these
label12.Text = "0.00";
for (int i = 0; i < checkedListBoxBeverage.Items.Count; ++i)
// set SetItemChecked property to false from true.
// it gets set to true when use checks it
checkedListBoxBeverage.SetItemChecked(i, false);
} // end of buttonclearBeverage
private void buttonClearSpecialty_Click(object sender, EventArgs e)
{
// uncheck all. Reset Specialty display
label14.Text = "";
// Reset specialty sub total box. the order total simply adds these
label15.Text = "0.00";
for (int i = 0; i < checkedListBoxSpecialty.Items.Count; ++i)
checkedListBoxSpecialty.SetItemChecked(i, false);
} // end of buttonclearSpeciality
// clear everything
// all clear button is clicked. prepare for a new order
//
private void buttonClearOrder_Click(object sender, EventArgs e)
{
//clear price boxes. so when total happens it is
// not only counting 0.00 but prices zerod out too
label5.Text = label12.Text =label15.Text = label17.Text ="0.00";
//labels cleaned. nothing remains visible in the order
label4.Text = label6.Text = label7.Text = label9.Text = label14.Text = "";
// uncheck all. walk thru all toppings items based upon the count
// of items in the checkedListBox. Reset Toppings display
for (int i = 0; i < checkedListBoxPizzaItems.Items.Count; ++i)
checkedListBoxPizzaItems.SetItemChecked(i, false);
// uncheck all. walk thru all beverage items based upon the count
// of items in the checkedListBox. Reset Beverage display
for (int i = 0; i < checkedListBoxBeverage.Items.Count; ++i)
checkedListBoxBeverage.SetItemChecked(i, false);
// uncheck all. walk thru all specialty items based upon the count
// of items in the checkedListBox. Reset Beverage display
for (int i = 0; i < checkedListBoxSpecialty.Items.Count; ++i)
checkedListBoxSpecialty.SetItemChecked(i, false);
} // end of buttonClearOrder Event
} // end of namespace
} // end of class