I am putting together this program for school where we have to make a "juice bar" application... It compiles with no errors and launches the form but when I try to use any of my buttons or anything nothing happens.... I am using visual studio 2008
If anyone could help or point me in the right direction it would help me out a lot.. thanks
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;
namespace Ch04HandsOn
{
public partial class JuiceBarForm : Form
{
//Declare class variables
decimal itemPriceDecimal, totalOrderDecimal, totalSalesDecimal;
int drinksInteger, ordersInteger;
public JuiceBarForm()
{
InitializeComponent();
}
private void addToOrderButton_Click_1(object sender, EventArgs e)
{
// Add the current item price and quantity to the order.
if (noSizeRadioButton.Checked)
{
MessageBox.Show("You must select a drink size.",
"Missing required entry");
}
else
{
try
{
int quantityInteger = int.Parse(quantityTextBox.Text);
if (quantityInteger != 0)
{
drinksInteger += quantityInteger;
totalOrderDecimal += itemPriceDecimal * quantityInteger;
orderCompleteButton.Enabled = true;
//reset defaults for next item
noSizeRadioButton.Checked = true;
fruitJuiceRadioButton.Checked = true;
vitaminPackCheckBox.Checked = false;
energyBoosterCheckBox.Checked = false;
ladiesCheckBox.Checked = false;
itemPriceTextBox.Clear();
quantityTextBox.Text = "1";
}
else
{
MessageBox.Show("Please enter a quantity.",
"Missing Required Entry");
}
}
catch (FormatException)
{
MessageBox.Show("Invalid quantity.", "Data Entry Error");
quantityTextBox.Focus();
quantityTextBox.SelectAll();
}
}
}
private void orderCompleteButton_Click_1(object sender, EventArgs e)
{
// Order is complete, add to summary and clear order.
// Check if the last item was adde to the total.
if (itemPriceTextBox.Text != "")
{
DialogResult responseDialogResult;
string messageString = "Current Item not recorded, Add to order?";
responseDialogResult = MessageBox.Show(messageString,
"Verify Last Drink Purchase", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (responseDialogResult == DialogResult.Yes)
{
addToOrderButton_Click_1(sender, e);
}
}
//Display amount Due.
string dueString = "Amount Due " + totalOrderDecimal.ToString("C");
MessageBox.Show(dueString, "Order COmpelte");
//Add to summary totals.
ordersInteger++;
totalSalesDecimal += totalOrderDecimal;
//Reset buttons and total for new order.
summaryButton.Enabled = true;
orderCompleteButton.Enabled = false;
totalOrderDecimal = 0m;
}
private void summaryButton_Click_1(object sender, EventArgs e)
{
//DIsokat tge sumamry ifnoirmun message box.
string summaryString = "Drinks Sold: " + drinksInteger.ToString()
+ "\n\n" + "Number of Orders: " + ordersInteger.ToString()
+ "\n\n" + "Total Sales: " + totalSalesDecimal.ToString("C");
MessageBox.Show(summaryString, "Juice Bar Sales Summary",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void exitButton_Click_1(object sender, EventArgs e)
{
// End the APplication.
this.Close();
}
private void twelveOunceRadioButton_CheckedCHanged(object sender, EventArgs e)
{
//calculate and display the price for the selected item.
//Handles all check boxes and radio buttons.
int extraInteger = 0;
if (twelveOunceRadioButton.Checked)
{
itemPriceDecimal = 3m;
}
else if (sixteenOunceRadioButton.Checked)
{
itemPriceDecimal = 3.5m;
}
else if (twentyOunceRadioButton.Checked)
{
itemPriceDecimal = 4m;
}
extraInteger = 0;
if (vitaminPackCheckBox.Checked)
{
extraInteger++;
}
if (energyBoosterCheckBox.Checked)
{
extraInteger++;
}
if (ladiesCheckBox.Checked)
{
extraInteger++;
}
itemPriceDecimal += extraInteger * .5m;
itemPriceTextBox.Text = itemPriceDecimal.ToString("C");
}
}
}

New Topic/Question
Reply




MultiQuote




|