using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace BiskLog_Point_Of_Sale.Dialogs { public partial class PriceAmendmentD : Form { public string newprice; public PriceAmendmentD(string pcode = null, string pname = null, string previous = null) { InitializeComponent(); productCode.Text = pcode; productName.Text = pname; txtCurrent.Text = previous; } private void EXXIT_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } private void Cllose_MouseEnter(object sender, EventArgs e) { EXXIT.BackColor = Color.Crimson; } private void Cllose_MouseLeave(object sender, EventArgs e) { EXXIT.BackColor = Color.FromArgb(20, 158, 132); } private void TxtnewP_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 46) { // accepts . character } else if (e.KeyChar == 8) { //accepts backspace } else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48-57 between 0-9 { e.Handled = true; } } private void TxtnewP_TextChanged(object sender, EventArgs e) { newprice = txtnewP.Text; if (String.IsNullOrEmpty(txtnewP.Text)) { BTNsave.Enabled = false; } else { BTNsave.Enabled = true; } } private void BTNsave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtnewP.Text)) { this.DialogResult = DialogResult.OK; this.Close(); } } } }