示例#1
0
文件: Form1.cs 项目: RBickell/CST117
 void txtclear()
 {
     TBProductName.Clear();
     TBCategory.Clear();
     NUDPrice.Value      = 0;
     NUDAddToStock.Value = 0;
 }
示例#2
0
        //Button Click code:
        private void BtnAddInventory_Click(object sender, EventArgs e)
        {
            int     ct  = Program.LstPrd.Count;
            Product prd = new Product(Product.GetNewID(), TBProductName.Text, TBCategory.Text, NUDPrice.Value, NUDAddStock.Value, NUDPrice.Value * NUDAddStock.Value);

            Program.LstPrd.Add(prd);


            if (Program.LstPrd.Count > ct)
            {
                MessageBox.Show("Product has been added", "Success", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Product not added", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            TBProductName.Clear();
            TBCategory.Clear();
            NUDPrice.Value    = 0;
            NUDAddStock.Value = 0;
            File.AppendAllText(Program.inputfile, System.Environment.NewLine + Convert.ToString(prd.ID) + "," + prd.ProductName + "," + prd.Category + "," + Convert.ToString(prd.Price) + "," + Convert.ToString(prd.AddInStock) + "," + Convert.ToString(prd.CostInStock));
        }