private void BuyButton_Click(object sender, EventArgs e) { if (BuyButton.Text == "Buy") { DiscountCodeTextBox.Visible = false; ActivateDiscountButton.Visible = false; ThankYouLabel.Text = "Thank you for your order!"; PurchaseDateLabel.Visible = true; Text = "Your receipt"; BuyButton.Text = "Close"; } else if (BuyButton.Text == "Close") { ShopWindow.ClearCart(); Application.Exit(); } }
private void ClosingReceipt(object sender, FormClosingEventArgs e) { if (BuyButton.Text == "Close") { ShopWindow.ClearCart(); Application.Exit(); } else { ReceiptDataGridView.Rows.Clear(); ReceiptDataGridView.Refresh(); ActivateDiscountButton.Enabled = true; DiscountCodeTextBox.Enabled = true; DiscountCodeTextBox.Text = "Discount Code"; DiscountCodeTextBox.ForeColor = SystemColors.InactiveCaption; ActivateDiscountButton.Click -= ActivateDiscountButtonClickHandler; } }