using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication3
{
public partial class BookForm : Form
{
public BookForm()
{
InitializeComponent();
}
private void calculatebutton_Click(object sender, EventArgs e)
{
const decimal decDISCOUNT_RATE = 0.15M;
int intQuantity = 0;
decimal decPrice, decExtendedPrice, decDiscount, decDiscountedPrice;
try
{
intQuantity = int.Parse(quantitytextBox.Text);
decPrice = decimal.Parse(pricetextBox.Text);
}
catch (FormatException myErr)
{
messagelabel.Text = " Error in input data.";
}
decExtendedPrice = intQuantity * decPrice;
decDiscount = decimal.Round(decExtendedPrice * decDISCOUNT_RATE, 2);
decDiscountedPrice = decExtendedPrice - decDiscount;
extendedPricelabel.Text = decExtendedPrice.ToString("C");
discountlabel.Text = decDiscount.ToString("C");
discountedPricelabel.Text = decDiscountedPrice.ToString("C");
}
private void clearbutton_Click(object sender, EventArgs e)
{
quantitytextBox.Clear();
tityletextBox.Clear();
pricetextBox.Clear();
extendedPricelabel.Text = "";
discountlabel .Text = "";
discountedPricelabel .Text = "";
quantitytextBox .Focus ();
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void BookForm_Load(object sender, EventArgs e)
{
}
}
}
我做了异常处理,怎么VS还是报错