using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; namespace InvoicingTool { public partial class CheckCommodityCount : Form { public string strValues { get; set; } public CheckCommodityCount() { InitializeComponent(); } public CheckCommodityCount(string GoodsName,decimal GoodsCount) { InitializeComponent(); lblGoodsName.Text = GoodsName; lblCount.Text = "系统当前库存数量:" + GoodsCount.ToString("F2"); } private void btnEnter_Click(object sender, EventArgs e) { if (txtPayment.Text=="") { MessageBox.Show("请输入商品盘点数量!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPayment.Focus(); txtPayment.SelectAll(); return; } try { decimal.Parse(txtPayment.Text.Trim()); } catch { MessageBox.Show("请输入正确的商品盘点数量!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPayment.Focus(); txtPayment.SelectAll(); return; } strValues = txtPayment.Text.Trim(); this.DialogResult = DialogResult.OK; this.Close(); } private void txtPayment_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode==Keys.Enter) { btnEnter_Click(null, null); } else if(e.KeyCode==Keys.Escape) { Close(); } } } }